![]() ![]() ![]() Once master and o/master are in sync, Satoshi is ready to merge everything into his topic branch.Ĭheckout this 30-second animation illustrating the process: Animation illustrating the merge workflow. ![]() Before Satoshi is ready to merge Ada’s changes into feature-2, he must first update his local master reference, as it’s currently trailing behind. Let’s start with the most common workflow for integrating changes: merge. Satoshi now has two options to integrate Ada’s changes into his branch feature-2 - merge or rebase. Ada then completed feature-1 by merging it into master (creating merge commit C4). Looking at the example above, we see that the developers Ada and Satoshi initially created two topic branches ( feature-1 and feature-2), stemming from the same commit ( C1) on the master branch. Notice also that the local “master” branch (C1) currently trails behind its remote counterpart “o/master” (C4). Before we look at their inner workings to understand what this means, let’s start with an example! History graph viewed from the eyes of Satoshi, with remote “origin” aliased as “o” for convenience. In other words, the key difference between merge and rebase is that while merge preserves history as it happened, rebase rewrites it. Reading the official Git manual states that rebase " reapplies commits on top of another base branch”, whereas merge " joins two or more development histories together”. If you know how the actions work, feel free to skip to the comparison section. In this post, I’ll illustrate and highlight the differences between the two options and point out things to look out for when performing the actions.įirst, I’ll go through the two operations in isolation using animations, finishing with a side-by-side comparison. With git there are two main options for this, either you merge, or you rebase. Regardless of which branching strategy your project is using, integrating code changes between branches is something that you need to do almost daily. 7 min read Photo by Joey Kyber / Unsplash. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |