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.

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.

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.
