Undo merge/reset change status
I made a fatal mistake using Gerrit and was wondering if anybody could provide a solution/idea to this:
Current situation is that I have a branch
feature-foo onto which our team is pushing changes for review.
Some of these changes are already submitted/merged, and a great number is still open for review.
Now, yesterday I decided to push a patchset to a specific change, one that has around 15 preceeding changes (not merged yet).
I accidentally pushed past code review (yes, I do have these permissions, and yes I was stupid enough to not deactivate them for my own safety – lesson learned).
This resulted in those 15 changes/commits to be pushed directly onto the branch instead of into code review.
So now all those changes are marked
MERGED in Gerrit. My immediate idea was to do a
push -f using the commit that I knew was originally the tip of
This correctly reset the branch to where it was supposed to be. But – those 15 changes are still marked
MERGED in Gerrit.
What I want: I need those changes to be back to state “Review in Progress”, because they are in fact still being worked on.
Any ideas, anybody? I cannot imagine that this has not happened to somebody before…
EDIT 1: To clarify – the incorrectly pushed commit resulted in a fast-forward – not a merge. Nevertheless, for Gerrit those changes/commits are still “MERGED”, as if somebody pressed “Submit Change” in the Gerrit-Webinterface.
So – this question is in fact about Gerrit, not Git itself.
keywords: accidental push, accidental merge
2 Solutions collect form web for “Undo merge/reset change status”
The only way I know is to push it again, using a new
Change-Id. This results in a new change being opened.
Well, it turns out that this did the trick:
- Reset the branch to where it is supposed to be (force push past code review)
- Power down Gerrit, access the underlying H2 database and reset the Status of all affected Change-IDs to “Review in Progress” (standard SQL, use project name, branch name and Change-ID in the WHERE-Clause).