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.
![Branch](/static/1b7c55ac526a6ed881c14c58095944d1/5a190/01.png)
A rebase will result in the branch history looking similar to the example below.
![Unify branches by using rebase](/static/eb7918c2bbcb5ccd3193fa4affacfe4b/5a190/02.png)
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](/static/3f70e989e6e03852eee799d6ac8dc15c/5a190/03.png)
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](/static/fa184cc78d5378a72f01fd2dc70f4100/5a190/04.png)