Upload
tadeusz-balcer
View
49
Download
0
Embed Size (px)
Citation preview
REUTERS / Eric Gaillard
Understanding GIT
Tadeusz Balcer12/5/2016
Centralized Version Control System (CVCS) (SVN, Perforce)
Source: https://git-scm.com/book/en/v2/book/01-introduction/images/centralized.png
Distributed Version Control System (DVCS) (GIT, Mercurial)
Source: https://git-scm.com/book/en/v2/book/01-introduction/images/distributed.png
Typical CVCS - differences
GIT – stream of snapshots.
GIT features
• Snapshot, not differences• Nearly every operation is local (no need network connection to work)• GIT has integrity (SHA-1 checksums)• Generally only adds data (It is hard to get the system to do anything that is not undoable)• Three states of files (commited, modified, staged)
The Three States
Source: https://git-scm.com/book/en/v2/book/01-introduction/images/areas.png
REUTERS / Edgar Su
Creating commit is like saving your game before you battle the boss.
Commit object
• pointer to the snapshot of content• author’s name and email• message• pointer to commit or commits that directly came before this commit (zero, one or many)
Commit object
Source: https://git-scm.com/book/en/v2/book/03-git-branching/images/commit-and-tree.png
Commit object
Source: https://git-scm.com/book/en/v2/book/03-git-branching/images/commits-and-parents.png
REUTERS / Mario Anzuoni
Merge vs rebase
Branch
3-way merge algorithm
1. Find a suitable merge base B - a version of the file that is an ancestor of both of the new versions (X and Y), and usually the most recent such base (although there are cases where it will have to go back further, which is one of the features of gits default recursive merge)
2. Perform diffs of X with B and Y with B.3. Walk through the change blocks identified in the two diffs. If both
sides introduce the same change in the same spot, accept either one; if one introduces a change and the other leaves that region alone, introduce the change in the final; if both introduce changes in a spot, but they don't match, mark a conflict to be resolved manually.
Merging
Merging
Merge conflicts
Merge conflicts (merge.conflictstyle=diff3)
Remote branches
Source: https://git-scm.com/book/en/v2/book/03-git-branching/images/remote-branches-2.png
Remote branches
Source: https://git-scm.com/book/en/v2/book/03-git-branching/images/remote-branches-3.png
Remote branches
Source: https://git-scm.com/book/en/v2/book/03-git-branching/images/remote-branches-5.png
Distributed workflows
Source: https://git-scm.com/book/en/v2/book/05-distributed-git/images/integration-manager.png
Rebase
Source: https://git-scm.com/book/en/v2/book/03-git-branching/images/basic-rebase-3.png
Fast-Forward
Source: https://git-scm.com/book/en/v2/book/03-git-branching/images/basic-rebase-4.png
Rebase
Source: https://git-scm.com/book/en/v2/book/03-git-branching/images/interesting-rebase-1.png
Rebase
Source: https://git-scm.com/book/en/v2/book/03-git-branching/images/interesting-rebase-2.png
Cherry-pick
Source: http://image.slidesharecdn.com/git-getreadytouseit-140228043813-phpapp02/95/git-get-ready-to-use-it-65-638.jpg?cb=1393562489
Resources
https://sivapremv.wordpress.com/2015/01/21/git-version-control-an-interesting-infographic-view/http://code.snipcademy.com/tutorials/git/fundamentals/three-states-areashttps://git-scm.com/book/en/v2/Getting-Started-Git-Basicshttps://www.quora.com/How-does-Git-merge-work