1. Learn center
  2. Software Development
  3. Guides
  4. Git tutorial
  5. Git collaboration
  6. Integrating branches
  7. Rebasing branches

Project and code management together.

Try it free

Rebasing branches

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

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


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 main branch, commits from the bugfix branch will be replayed and appended to the end of the main branch. The 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 main. In any case, you can do a fast-forward or a clean merge from bugfix to main after rebasing.

Unify branches by using rebase

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life