The Git Merge Handbook β Definitive Guide to Merging in Git
By reading this post, you are going to really understand git merge, one of the most common operations you'll perform in your Git repositories. Notes before we start I also created two videos covering the contents of this post. If you wish to watch a...
By reading this post, you are going to really understand git merge, one of the most common operations you'll perform in your Git repositories.
Before we start
I also created two videos covering the contents of this post. If you wish to watch alongside reading, you can find them here (Part 1Part 2).
I am working on a book about Git! Are you interested in reading the initial versions and providing feedback? Send me an email: gitting.things@gmail.com
In this guide, you got an extensive overview of merging with Git. You learned that merging is the process of combining the recent changes from several branches into a single new commit. The new commit has two parents β those commits which had been the tips of the branches that were merged.
We considered a simple, fast-forward merge, which is possible when one branch diverged from the base branch, and then just added commits on top of the base branch.
We then considered three-way merges, and explained the three-stage process:
First, Git locates the merge base. As a reminder, this is the first commit that is reachable from both branches.
Second, Git calculates two diffs β one diff from the merge base to the first branch, and another diff from the merge base to the second branch. Git generates patches based on those diffs.
Third and last, Git applies both patches to the merge base using a 3-way merge algorithm. The result is the state of the new, merge commit.
We dove deeper into the process of a 3-way merge, whether at a file level or a hunk level. We considered when Git is able to rely on a 3-way merge to automatically resolve conflicts, and when it just can't.
You saw the output of git diff when we are in a conflicting state, and how to resolve conflicts either manually or with VS Code.
There is much more to be said about merges β different merge strategies, recursive merges, and so on. Yet, after this guide, you should have a robust understanding of what merge is, and what happens under the hood in the vast majority of cases.
New features, version control best practices and stories about the Plastic SCM development.
Git Pocket Guide
ChapterΓΒ 7.ΓΒ Merging Merging is the process of combining the recent changes from several branches into a single new commit that is on all those branches. Most often there are β¦ - Selection from Git Pocket Guide [Book]
How trees are made | Git from the Bottom Up
Every commit holds a single tree, but how are trees made? We know that blobs are created by stuffing the contents of your files into blobs β and that trees own blobs β but we havenβt yet seen how the tree that holds the blob is made, or how that tree gets linked to its parent commit.
βIβve Got a Feelingβ is a song by the English rock band the Beatles from their 1970 album Let It Be. It was recorded on 30 January 1969 during the...
Did John Lennon or Paul McCartney Write the Classic 'A Day in the Life'?
'A Day in the Life' has been called the greatest Beatles song of all time. Here's which half of the Lennon-McCartney team was mostly behind it.
I've Got a Feeling Lyrics
by John Lennon and Paul McCartney As Recorded by John Lennon (Demo 1968) Everyone had a hard year Everyone had a good time Everyone had the ...