inblog logo
|
sson17
    git

    [git]1.git명령어 모음

    손영민's avatar
    손영민
    Apr 14, 2025
    [git]1.git명령어 모음
     
    # 사용자 정보 설정 git config --global user.name "Your Name" git config --global user.email son7571@github.com "you@example.com" # 새 저장소 초기화 git init git add . # 모든 변경된 파일 추가 # 변경사항 커밋
    # 원격 저장소 추가 git remote add origin 주소
    # 원격 저장소 목록 확인 git remote -v
    # 원격 저장소에 변경사항 푸시 git push origin master
    # 커밋 이력 확인 git log
     
    원격저장소 변경 git remote set-url origin <새로운GITURL>
     
    git status
     
    notion image
    바뀐 파일 표시
     
    git clone 주소
    notion image
    notion image
     
     
    git pull origin master
     
    notion image
     
    cd 파일경로 cd ..
    파일 이동
     
    git reset --hard 해시
    해시 파일로 리셋
     
    git reflog
    Git의 로컬 히스토리를 조회
     
     
     
     
    notion image
    같은파일에 다른 해시를 가진파일을 업로드 하여 충돌남
    이럴때는 2가지 방법
     
    git push -f origin master
    강제로 덮어쓰기
     
    git pull -f origin master
    강제로 파일 덮어씌우기
     
    git log --oneline
    깃허브에 올라간 파일 조회가능
     
     
    git branch
    브랜치 생성
     
    git branch -d <로컬 브랜치 이름>
    브런치 삭제
     
    git checkout
    브랜치 이동
     
    git checkout -b
     
    git checkout -- (변경사항있는파일링크)
    해당 파일의 변경 사항 되돌리기
     
     
    git merge (이동할 코드이름) a -> (이동할 코드이름)
     
     
    Share article

    sson17

    RSS·Powered by Inblog