1
  • Have 2 branches (say A & B) merged the changes from A to B (executed git pull . A in branch B). There was a merge commit that happened.
  • Now had to revert that merge on B (so did git revert -m)
  • So due to revert, the commits from A are reverted back in B
  • There are other commits on B done later on

Now when I again try to pull from A to B, those changes that were reverted are not being pulled. How do I pull those changes as well?

Sudheendra
  • 29
  • 5
  • Can you show us the exact `git revert` command you ran? – Tim Biegeleisen Jan 08 '18 at 07:56
  • If you reverted the commits, those stay reverted. If you want to remove the revert, you could delete the revert commit or revert it. – C-Otto Jan 08 '18 at 08:15
  • Possible duplicate of [Re-doing a reverted merge in Git](https://stackoverflow.com/questions/1078146/re-doing-a-reverted-merge-in-git) – max630 Jan 08 '18 at 11:51

2 Answers2

0

When you try to merge A again, it fails because those commits are already on B although a later revert commit has undone their changes.

Now if you want to merge them again, just revert that revert commit. It brings back the reverted changes.

ElpieKay
  • 27,194
  • 6
  • 32
  • 53
0

Try:

git reset --hard HEAD~3

The last three commits (HEAD, HEAD^, and HEAD~2) were bad and you do not want to ever see them again. Do not do this if you have already given these commits to somebody else.

Jishnunand P K
  • 145
  • 1
  • 8