git general

Post on 14-May-2015

653 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Confidential and Proprietary

UNDERSTANDING GIT

Chen, ZhongkeMar 15, 2012

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

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

Confidential and Proprietary

GIT CONCEPTS: REPOSITORY, REVISION, WORKING DIRECTORY, STAGE

Confidential and Proprietary

EXERCISE 1

› git config --global user.name “zhongkchen”› git config --global user.email zhongkchen@paypal.com › 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

Confidential and Proprietary

GIT CONCEPTS: BRANCH AND MERGE 1

Confidential and Proprietary

GIT CONCEPTS: BRANCH AND MERGE 2

Confidential and Proprietary

GIT CONCEPTS: BRANCH AND MERGE 3

Confidential and Proprietary

EXERCISE 2

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

› Advanced: git rebase, git cherry-pick

Confidential and Proprietary

GIT CONCEPTS: CLONE, FETCH, PUSH

Confidential and Proprietary

EXERCISE 3

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

› advanced:– config file– git remote

top related