3. Why Version Control?
•History is important.
•Time travel is possible!
o Roll back to old version
•Collaboration
o Contributors can work at the same time.
7. History
In 2005, relationship between Linux Kernel
community and commercial company of
BitKeeper broken down for reasons.
8. Goals of Git
•Speed
•Simple design
•Strong support for non-linear development
(branches over the world)
•Fully distributed
•Able to handle large projects efficiently
(Linux kernel is really huge)
28. Guidelines to Commit
No whitespaces
$ git diff --check
• Try to make each commit a logically
separate change set.
• Getting in the habit of creating quality
commit messages.
o This would help others to review.
42. Data Structure
•Blob
o Storing file data
•Tree
o Structure of project, just like directory
•Commit
o A pointer to a single tree, with some meta-data
•Tag
o Mark a commit as special
53. Merge Mechanism
•Fast-forward
Branches are in the same history flow so Git can only
change the pointer to the new one.
•Three-way merge
– Locate the common ancestor
– Git automatically calculate how to merge
– Create a merge commit recording new snapshot
55. Three-way merge
$ git checkout master
$ git merge topic1
Merge made by recursive
C0 C1 C2
topic1
C3
C4
master
C5
Snapshot to
merge into
Snapshot to
merge into
Common
Ancestor C6
master