3. Clone
• Git 서버에 있는 repository를 자신의 환경으로 복제하는 기능
• #git clone [repository경로]
Git server;remote
repository1
repository2
…
local
Cloning;복제
local
Cloning 작업 후 상태
repository1
4. Add & Commit
• 제출할 작업 목록으로 작업한 내용을 올려놓는 기능
• #git add [commit할 파일명]
#git commit –m “[commit 메시지]”
local
repository1 Commit list
수정된 코드1
adding
수정된 코드2
Added list
committing
Committing 작업 후 상태
local
repository1
Commit list
-m “버그수정”
버그수정
5. Push
• Commit 한 작업을 git server로 전송하는 기능
• #git push
local
repository1
Commit list
버그수정
Git server;remote
repository1
7. Reset
• Added list에 올려놓은 작업 내용을 초기화하는 기능
• #git reset
local
repository1
Added list
수정된 코드1
수정된 코드2
Git reset 수행 후 상태
local
repository1
수정된 코드1
수정된 코드2
Added list
[empty]
9. Pull
• Fetch 한 후 자신의 환경으로 해당 작업을 병합하는 기능
• #git pull
master
local
작업1 ②작업2
HEAD
작업1
HEAD
①cloning
③로컬작업1
④pushing
! Fetch first
Pulling 작업 후 상태
local
repository1
Added list
작업2로컬작업1
원래 있었던 것 처럼 병합됨
10. Checkout
• Branch 를 다루는 기능
• #git checkout –b [생성할 branch 명]
• #git checkout [변경할 branch 명]
• #git checkout –d [제거할 branch 명]
여러 작업을 동시에 진행해야 하거나, 기능별 적용 일정이 다를 경우
master 작업1
작업2branch1
작업3branch2
작업…
열일…
pushing
pushing
12. Cherry-pick
• 특정 commit을 가져오는 기능
• #git cherry-pick [commit]
다른 branch에서 작업한 내용중 일부가 필요할 경우
master 작업1
작업2branch1 Bugfix 다른작업
작업이 안끝나서 그대로 pull 수행하면 에러날 때
Cherry picking
Bugfix
13. Squash
• 여러 commit을 하나로 통합하는 개념
하나의 작업이 여러 commit으로 나뉘어져 있는 경우, commit history 관리를 위해 통합 작업 필요
master 작업1
작업2작업2-branch 작업2-오타수정
HEAD
Squash [작업2+오타수정]
HEAD
HEAD를 작업의 시작으로 이동시킨 후, commit을 수행
14. Stash
• 현재 작업 중인 내용을 임시 stack에 올려 두는 기능
• #git stash
master 작업1
작업2branch1
현재 진행중인 작업이 안끝났는데 다른 branch에서 quick fix가 필요한 경우
①Quick fix required
작업2
③ 작업1 ④bugfix
pushing
stash
②stashing ⑤ stash pop
작업2
⑥작업 재진행