1

I had several changes on branch A which I was happy about. Accidentally, branch A was merged into unrelated branch B. While working on branch B, instead of reverting the offending merge (which I now realize would be the way to go), and both branches were unrelated, I removed or pulled from master the files I knew were changed (solely) by A.

B eventually was merged into master, and since A was wrongly merged into B, it is also seen as merged although every change it made was either removed or checked out.

So my question is: how can I recover the changes A was supposed to have?

I have the hashes, but I can't just branch and merge the desired commit in A because B, which is more recent, removed/checked out all changes in A.

1 Answer 1

1

If the changes from A that were backed out on branch B with discreet commits (containing no other changes), you should use git revert <commit ID> to invert the inappropriate changes on the master branch.

1
  • Great! I git revert-ed the 4 faulty commits and used git reset --soft HEAD~4 to undo the revert commits so I could branch the changes.
    – Leo Brito
    Commented Jan 6, 2015 at 15:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.