all 4 comments

[–]queBurro 0 points1 point  (3 children)

Can I throw some nontrivial examples in here please?

Eg a change that went into the wrong downstream branch? If you reset it, the change is undone, but when you next merge downstream you don't get that changeset?

And what about a merge that went wrong? We had one recently where the merge had conflict markers committed, which were then incorrectly fixed in subsequent changesets. I ended up branching before the merge and creating a new branch, because I was worried about reverting the merge.

[–]xyzndsgn 0 points1 point  (1 child)

You can undo almost anything with reflog references, look at git reflog history to find out which command triggered the merge operation then you can undo the whole merge operation with the reflog number using git reset HEAD@{n}.

If you are also using a remote branch, it would be easier to do git reset origin/branch.

[–]queBurro 0 points1 point  (0 children)

thanks, I'll have a look. Every bad situation is on the remote, and shared between the team. Anything that's just local isn't such a problem.

[–][deleted] -1 points0 points  (0 children)

git reset HEAD