Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undo merge/reset change status

Tags:

git

gerrit

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 feature-foo.

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...

regards,

--qu

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

like image 949
quaylar Avatar asked Nov 02 '22 07:11

quaylar


1 Answers

The only way I know is to push it again, using a new Change-Id. This results in a new change being opened.

like image 143
StephenKing Avatar answered Nov 08 '22 09:11

StephenKing