![]() ![]() Existing commits on the source branch are unchanged and remain valid it doesn’t matter if they’ve been shared with others.This separation can be useful in the case of feature branches, where you might want to take a feature and merge it into another branch later. The commits on the source branch remain separate from other branch commits, provided you don’t perform a fast-forward merge.Maintains the original context of the source branch.So, what are the pros and cons of merging and rebasing? Pros and Cons This has important ramifications which we’ll talk about below. But this rebase requires the commits on the source branch to be re-written, which changes their content and their SHAs. So merging keeps the separate lines of development explicitly, while rebasing always ends up with a single linear path of development for both branches. Here’s a visual comparison between merging and rebasing a branch ‘feature/awesomestuff’ back to the master branch (click for full size): In contrast, rebasing unifies the lines of development by re-writing changes from the source branch so that they appear as children of the destination branch – effectively pretending that those commits were written on top of the destination branch all along. ![]() Merging brings two lines of development together while preserving the ancestry of each commit history. Let’s start by defining what merging and rebasing are. So which one do you use? What does Merge or Rebase mean? Eventually some or all of these commits have to be brought together into a shared graph, and merging and rebasing are two primary ways that let us do that. They have to be, since their design strongly encourages developers to commit changes in parallel in their own distributed environments. Merge or Rebase? By Steve on August 21, 2012Īs you’re no doubt aware, Git and Mercurial are great at re-integrating divergent lines of development through merging.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |