More Related Content Similar to Quick Introduction to git Similar to Quick Introduction to git (8) Quick Introduction to git6. Bob
Carol
Alice
Ted
A recipe for disaster!
8. > Distributed revision control system
> Originally developed by Linus Torvalds for the
development of the Linux Kernel in 2005
> Focus on speed and efficiency
> Quite a unique design and therefore sometimes a bit
scary and difficult to understand
10. A “blob” is content under
version control (a file)
blob
11. You can have trees of blobs
(directories of files)
tree
blob
tree
blob
blob
12. A “commit” is a tree of blobs
(a set of changes)
commit
tree
blob
tree
blob
blob
13. Most commits modify
(or merge) earlier
commits
commit
commit
tree
tree
blob
blob
tree
blob
blob
14. You can “tag” an
interesting commit
tag
commit
commit
tree
tree
blob
blob
tree
blob
blob
15. A graph of commits
may belong to a branch branch
tag
commit
commit
tree
tree
blob
blob
tree
blob
blob
16. HEAD
“HEAD “is the
current branch
branch
tag
commit
commit
tree
tree
blob
blob
tree
blob
blob
17. HEAD
branch
commit
commit
Let’s focus on commits
and branches
23. John Jane
Local repo Public repo Local repo
master
C1
C0
24. John Jane
Local repo Public repo Local repo
master master master
C1 C1 C1
C0 C0 C0
25. John Jane
Local repo Public repo Local repo
master master master
C2 C1 C3
C1 C0 C1
C0 C0
26. John Jane
Local repo Public repo Local repo
master master master
C2 C1 C3
C1 C0 C1
C0 C0
(nothing new to pull)
27. John Jane
Local repo Public repo Local repo
master master master
C2 C2 C3
C1 C1 C1
C0 C0 C0
28. John Jane
Local repo Public repo Local repo
master master master
C2 C2 C3 C2
C1 C1 C1
C0 C0 C0
29. John Jane
Local repo Public repo Local repo
master master master
C2 C2 C4
C1 C1 C3 C2
C0 C0 C1
C0
NB: git pull = fetch + merge
30. John Jane
Local repo Public repo Local repo
master master master
C2 C4 C4
C1 C3 C2 C3 C2
C0 C1 C1
C0 C0
31. John Jane
Local repo Public repo Local repo
master master master
C4 C4 C4
C3 C2 C3 C2 C3 C2
C1 C1 C1
C0 C0 C0
34. HEAD
master
origin/master C2
C1
C0
35. HEAD
tryout
master
origin/master C2
C1
C0
36. HEAD
tryout
master
origin/master C2
C1 NB: git checkout –b … =
branch + checkout
C0
37. HEAD
tryout
master
C3
origin/master C2
C1
C0
38. HEAD
tryout
master
C3 C5
C2
origin/master
C1 C4 C6
C0 origin/idea
39. HEAD
tryout
C7
master
C3 C5
C2
origin/master
C1 C4 C6
C0 origin/idea
40. tryout
HEAD
C7
master
C3 C5
C2
origin/master
C1 C4 C6
C0 origin/idea
41. HEAD
tryout
master
C7
C8
C3 C5
C2
origin/master
C1 C4 C6
C0 origin/idea
42. HEAD
tryout
master
C7
origin/master C8
C3 C5
C2
C1 C4 C6
C0 origin/idea
43. Overview git workflow
Remote repository
fetch push
Local repository
pull commit
checkout Index (cache)
HEAD add
Working directory
45. First steps
> Follow instructions on P2 Blog for installation
> Send your ssh public key to joel.krebs@students.unibe.ch
> Create meaningful commits with according messages
> Hints that make your life easier:
—Create a .gitignore file
—Always pull before you push
—Don’t panic when merge conflicts occur
47. More to git …
> Merging and mergetool
> Squashing commits when merging
> Resolving conflicts
> User authentication with ssh
> gitx and other graphical tools
> git configure — remembering your name
> git remote — multiple remote repos
> github — an open source public repo
> …
48. Resources
http://git-scm.com/ http://book.git-scm.com/index.html
http://gitready.com/
https://github.com/
http://www.slideshare.net/chacon/getting-git http://oreilly.com/