How to resolve conflicts during a Git rebase (Git)

When you rebase a commit or a branch on top of a different HEAD, you may eventually see a conflict.

If there is a conflict, you will be asked to solve the merge conflict and continue with the rebase using git rebase --continue.

Step 1 : Check out the branch named rebaseExample2, which tracks origin/stable-3.1:

Step 2 : Make a commit on the branch:

Step 3 : Try to rebase the branch on top of the rebaseExample branch:

Step 4 : You can solve the conflict in your preferred editor. Then, add the file to the index using git add and continue with the rebase.

Step 5 : We can now check with gitk to see whether our change is rebased on top of the rebaseExample branch, as shown in the following screenshot: