Reputation: 159
I submitted a patch for review to Gerrit, which created a review page. I wanted to update the patch with some modifications, but unfortunately ended up submitting a new patch, which depended on the old one, along with a new corresponding review page. This happened because I did not amend to the previous commit, rather I made a new commit and pushed that for review.
What I'm wondering now is if there is a way revert the most recent commit, amend changes to the older commit and have that be reflected on Gerrit, thus removing the most recent review page and update the old one.
Feel free to edit my question, or ask me if I'm not being clear.
Upvotes: 4
Views: 19247
Reputation: 5532
Sure this is possible. There are 2 tasks - Clean up your Git repository and update Gerrit.
To clean up git, there are a couple approaches. The most automatic method is to squash your 2 current commits together using git rebase -i
. Another option is to do something like git checkout HEAD^ && <make edits> && git commit --amend
.
Once you are happy with your git tree, push up to Gerrit creating a new patch set for your original change. Then use the 'Abandon' button on the change you made accidentally and you should be good to go.
Upvotes: 5