1

I forgot to do a pull before creating a new branch. I did not recognize that, did the work and a finishing merge. Now I see that the starting point of the new (and now merged) branch is wrong as it is too far in the past.

Is it possible to correct that?

user3142695
  • 13,907
  • 34
  • 141
  • 281

1 Answers1

0

Assume the history consists of two branches - master & topic. topic is the branch you created from master without doing a git pull.

git reset --merge ORIG_HEAD  // Undo git-merge
git checkout master
git pull
git rebase master topic  // Replay commits of topic on new master

After this you can proceed with merge (if required).


For more detail on undo git-merge, refer here

Community
  • 1
  • 1
Rishit Sanmukhani
  • 2,099
  • 13
  • 25