
SourceTree guides you through this process, but it can still become a bit more complicated. With a conflict, you have to resolve the conflict in order to continue the rebase. Each commit is rebased in order, and a conflict will interrupt the process of rebasing multiple commits. Slightly more complex, especially under conflict conditions.Is the most intuitive and clutter-free way to combine commits from multiple developers in a shared branch.If the need to merge arises simply because multiple people are working on the same branch in parallel, the merges don’t serve any useful historic purpose and create clutter.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.

#Sourcetree rebase in progress full#
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.
