For a cleaner revision history, you can use the git rebase command to integrate your branches.g

Say we have two branches with a non fast-forward merge scenario.


Doing a rebase will result in the branch history looking similar to the example below.

Unify branches by using rebase

When you rebase a bugfix branch to the master branch, commits from the bugfix branch will be replayed and appended to the end of the master branch. The end result is a single simple stream of commits in the bugfix branch history.

In the event of a conflict when the commit is being appended, you will be asked by Git to fix the conflict before proceeding with rebasing the other commits.

Unify branches by using rebase

A rebase does not move the position of the master. In any case, you will be able to do a fast-forward or a clean merge from bugfix to master after rebasing.

Unify branches by using rebase