git rebase master

and you get conflicts. Here’s how to proceed:

1. fix conflicts

Look for CONFLICT and edit the file mentioned. Note: the path is to the root of the git repo not where you are currently

2. git add <conflicted files>

3. git rebase –continue

Once you’ve merged and do a git status I got:

Your branch and 'origin/feature/branch' have diverged,
and have 168 and 52 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)

This would be because I’d already pushed my feature branch. i.e. you’re changing the history of all those commits by doing the rebase

The solution is, assuming you’re the only one using your feature branch, is to force push.

A trick to make this less dangerous is to use git push --force-with-lease rather than git push -f. This way if someone did get hold of your feature branch and push a change it would fail instead of overwriting the new commit.

However the golden rule is – don’t use rebase on public branches. If you’ve pushed then


More here:

and here:



Note: If everything goes wrong:

git rebase –abort

Leave a Reply

Your email address will not be published. Required fields are marked *