1. Introduction Basics Using git Other final
Git - the stupid content tracker
Henrik Austad
UNINETT Sigma A/S
15. Oct 2009
2. Introduction Basics Using git Other final
about:henrik
Henrik Austad
MSc Engineering Cybernetics
UNINETT Sigma A/S & NDGF
System Developer
3. 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
4. Introduction Basics Using git Other final
Contenders
• Bazaar (bzr)
• Darcs
• Mercurial (hg)
• svk
5. Introduction Basics Using git Other final
What does “distributed” mean?
• Everything is local.
6. Introduction Basics Using git Other final
What does “distributed” mean?
• Everything is local.
• No “need” for a centralized repository.
7. 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.
8. 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 special
access to the repository to get started.
9. Introduction Basics Using git Other final
git objects
• type
• blob
• tree
• commit
• tag
• size
• content
10. Introduction Basics Using git Other final
git objects
• type
• blob
• tree
• commit
• tag
• size
• content
Figure: git example.credits: Scott Chacon
11. Introduction Basics Using git Other final
Normal commands
• git clone repo dest
• git init
12. 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
13. 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
14. Introduction Basics Using git Other final
Normal commands
• git remote
• git push
• git pull
• git fetch
15. Introduction Basics Using git Other final
Normal commands
• git tag
• git diff
• git format-patch
• git am
16. Introduction Basics Using git Other final
Normal commands
• git config –global user.name “Henrik Austad”
• git config –global user.email “henrik@austad.us”
• git config user.email “local@project.mail”
• git config push.default current
17. Introduction Basics Using git Other final
git merge vs. git rebase
An example, 3 branches, commits done in alphabetical order
18. Introduction Basics Using git Other final
git merge vs. git rebase
Merge F and D giving H, then H and G giving I
19. Introduction Basics Using git Other final
git merge vs. git rebase
Rebase F onto D, rewriting F to F’, then C-F’ onto G
20. Introduction Basics Using git Other final
Hooks - it’s a kind of magic
See .git/hooks/
• pre-commit
• post-update
21. Introduction Basics Using git Other final
Visualization
• git log –graph
• git-gui
• gitk
• qgit
22. Introduction Basics Using git Other final
Questions?
http://git-scm.com/
mailto:git@vger.kernel.org
http://www.kernel.org/pub/software/scm/git/docs/
everyday.html