본문 바로가기

PROGRAMMING/GIT

[GIT] 명령어 정리

git 생성 git init
저장소 복제해오기 git clone [path]
로컬 브랜치 목록 보기 git branch
원격(remote) 브랜치 목록 보기 git branch -r
전체 브랜치 목록 보기 git branch -a
브랜치 원격 저장소와 로컬 동기화 git remote prune origin
브랜치 이름 변경 git branch -m [branch_name] [change_name]
브랜치 변경 git checkout [branch_name]
원격 브랜치로 변경 git checkout -r [path/branch_name]
브랜치 삭제 git branch -d [branch_name]
저장소에서 최신코드 복제해오기 git fetch
저장소에서 최신코드 복제해오기 + merge git pull
merge 취소 git reset
수정한 코드 전체 커밋하기 git commit  -a
커밋한 코드 전체 push git push --all
수정한 코드 전체 커밋하기(코멘트 추가) git commit  -a -m "comment"
브랜치 merge git merge [branch_name]
커밋 로그 확인 git log
최신 작업 순 로그 확인 git reflog
가장 최근에 한 작업 실행 취소 git reset HEAD@{1}

 

옵션이 있는 것들은

-a : all

-r : remote

-d : delete

-m : modifiy

라고 생각하면 될 것 같다.