Upload
henrikau
View
1.497
Download
1
Tags:
Embed Size (px)
DESCRIPTION
Basic introduction to git, the object database and the most common commands.
Citation preview
Introduction Basics Using git Other final
Git - the stupid content tracker
Henrik Austad
UNINETT Sigma A/S
15. Oct 2009
Introduction Basics Using git Other final
about:henrik
Henrik AustadMSc Engineering Cybernetics
UNINETT Sigma A/S & NDGF
System Developer
Introduction Basics Using git Other final
Background - In the beginning ... was patch
• Initially written by Linus Torvalds to replace BitKeeper
• First “working” version: April 18th 2005
• git v1.0 December 21th 2005
• Written for• Speed• Track changes• Large projects with active history
Introduction Basics Using git Other final
Contenders
• Bazaar (bzr)
• Darcs
• Mercurial (hg)
• svk
Introduction Basics Using git Other final
What does “distributed” mean?
• Everything is local.
• No “need” for a centralized repository.
• Disk is cheap - network is not.
• Lower threshold for new developers, you don’t need specialaccess to the repository to get started.
Introduction Basics Using git Other final
What does “distributed” mean?
• Everything is local.
• No “need” for a centralized repository.
• Disk is cheap - network is not.
• Lower threshold for new developers, you don’t need specialaccess to the repository to get started.
Introduction Basics Using git Other final
What does “distributed” mean?
• Everything is local.
• No “need” for a centralized repository.
• Disk is cheap - network is not.
• Lower threshold for new developers, you don’t need specialaccess to the repository to get started.
Introduction Basics Using git Other final
What does “distributed” mean?
• Everything is local.
• No “need” for a centralized repository.
• Disk is cheap - network is not.
• Lower threshold for new developers, you don’t need specialaccess to the repository to get started.
Introduction Basics Using git Other final
git objects
• type• blob• tree• commit• tag
• size
• content
Figure: git example.credits: Scott Chacon
Introduction Basics Using git Other final
git objects
• type• blob• tree• commit• tag
• size
• content
Figure: git example.credits: Scott Chacon
Introduction Basics Using git Other final
Normal commands
• git clone repo dest
• git init
Introduction Basics Using git Other final
Normal commands
• git status
• git log start..end
• git branch name of new branch start commit
• git checkout branchname
Introduction Basics Using git Other final
Normal commands
• git add path/to/file
• git commit -s -m “short commit msg”
• git rebase -i commit
• git cherry-pick commit
Introduction Basics Using git Other final
Normal commands
• git remote
• git push
• git pull
• git fetch
Introduction Basics Using git Other final
Normal commands
• git tag
• git diff
• git format-patch
• git am
Introduction Basics Using git Other final
Normal commands
• git config –global user.name “Henrik Austad”
• git config –global user.email “[email protected]”
• git config user.email “[email protected]”
• git config push.default current
Introduction Basics Using git Other final
git merge vs. git rebase
An example, 3 branches, commits done in alphabetical order
Introduction Basics Using git Other final
git merge vs. git rebase
Merge F and D giving H, then H and G giving I
Introduction Basics Using git Other final
git merge vs. git rebase
Rebase F onto D, rewriting F to F’, then C-F’ onto G
Introduction Basics Using git Other final
Hooks - it’s a kind of magic
See .git/hooks/
• pre-commit
• post-update
Introduction Basics Using git Other final
Visualization
• git log –graph
• git-gui
• gitk
• qgit
Introduction Basics Using git Other final
Questions?
http://git-scm.com/
mailto:[email protected]
http://www.kernel.org/pub/software/scm/git/docs/everyday.html