12
Confidential and Proprietary UNDERSTANDING GIT Chen, Zhongke Mar 15, 2012

Git General

Embed Size (px)

Citation preview

Page 1: Git General

Confidential and Proprietary

UNDERSTANDING GIT

Chen, ZhongkeMar 15, 2012

Page 2: Git General

Confidential and Proprietary

HISTORY

SCCS/RCS('70~'80)

• Single File

VSS('90)

• check-out/check-in 

CVS('90)

• update/commit

SVN('00)

• atomic commit

TeamWare,BitKeeper, GIT,Mercurial,Bazaar

('00)

• Distributed?

Centralized

Page 3: Git General

Confidential and Proprietary

WHAT’S GIT

› Git is an open source version control system designed for speed and efficiency

distributed

› Initial developed by Linus Torvalds

› Used by e.g. Linux kernel and Ruby on Rails, Android

Page 4: Git General

Confidential and Proprietary

GIT CONCEPTS: REPOSITORY, REVISION, WORKING DIRECTORY, STAGE

Page 5: Git General

Confidential and Proprietary

EXERCISE 1

› git config --global user.name “zhongkchen”› git config --global user.email [email protected] › git init # create a new repository› git add # add file to stage› git rm› git mv› git commit # commit files from stage to repo› git status # check the status of working dir and stage› git log # check history in repo› git diff # compare working dir with stage › git diff --cached # compare stage with the repo› .gitignore # a special file

› Advanced: git stash, git blame, git reset, git revert

Page 6: Git General

Confidential and Proprietary

GIT CONCEPTS: BRANCH AND MERGE 1

Page 7: Git General

Confidential and Proprietary

GIT CONCEPTS: BRANCH AND MERGE 2

Page 8: Git General

Confidential and Proprietary

GIT CONCEPTS: BRANCH AND MERGE 3

Page 9: Git General

Confidential and Proprietary

EXERCISE 2

› git branch› git checkout› git merge› git branch -d

› Advanced: git rebase, git cherry-pick

Page 10: Git General

Confidential and Proprietary

GIT CONCEPTS: CLONE, FETCH, PUSH

Page 11: Git General

Confidential and Proprietary

EXERCISE 3

› git clone › git fetch origin› git merge› git push origin master› git pull

› advanced:– config file– git remote