1

I accidentally merged a few commits into the wrong branch (development)

I reverted this via a revert PR, and then merged into the correct branch (Sprint-7)

The team then merged Sprint-7 -> Development -> Sprint-8

Now, Sprint-8 doesn't have my commits from the revert, and when I try to PR from Sprint-7 -> Sprint-8 it shows no differences

I tried to un-un-revert but there's a conflict in our db snapshot so I'm nervous to try it. How else might I resolve this issue?

2
  • what is the "revert PR"? is it github or just git? Commented Dec 29, 2019 at 2:48
  • You can try the trick that I outlined in another answer. But you must be the one who does the merge; you cannot rely on some foreign instance to do it for you. Commented Dec 29, 2019 at 8:08

1 Answer 1

1

The problem is that git knows that those two commits were on Development and reverted. Merging Sprint-7 into development will ignore those two commits.

An easy way out is to recreate those two commits as new commits with the same changes and even commit message but not associated by way of cherry-pick etc. An easy way to do this is when on the commit run git reset --soft HEAD^ which will position you to the previous commit with the commit changes you were on staged. Committing that will create a new unrelated but otherwise equal commit. You can cherry-pick commits like this directly onto Development.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.