In a project managed by Gerrit I have several reviews that really should be one review. The developer forgot to amend his commits. Do I fix this using git to squash the commits into one commit git rebase --interactive HEAD~7
or can I do it through the Gerrit web interface?
Will Gerrit notice the changes are in twice and abandon the older erroneous reviews?
Asked
Active
Viewed 2,977 times
3

Clutch
- 7,404
- 11
- 45
- 56
-
possible duplicate of [Gerrit: combine multiple commits into one "change"](http://stackoverflow.com/questions/18535695/gerrit-combine-multiple-commits-into-one-change) – helmbert Apr 29 '15 at 20:57
1 Answers
3
Gerrit currently doesn't have a fancy web-UI way of solving this. Just squash all the commits in one commit and push it again.
The commit with that change-id will be updated, and you should abandon all the other commits which should no longer exist (i.e., the ones you squashed into the pushed commit).

Mureinik
- 297,002
- 52
- 306
- 350
-
Did it with a git rebase --interactive HEAD~11 fixup down to the oldest commit/review then pushed. On Gerrit, I made sure it could be submitted. Then abandoned the other reviews. Slick. – Clutch Apr 30 '15 at 19:33
-
More detailed instructions and hope they're helpful: If you want to squash the last N commits into one, you can run `git rebase --interactive HEAD~N`, then in the popup editor, keep the first 'pick', and change all following commits to 's' (squash), and then save and quit. In the next popup editor, edit the commit message as you like (maybe only keep the last change ID), then save and quit. Then run sth like `git push origin HEAD:refs/for/master` to push it. Now the code in gerrit would include all the commits. – fstang Aug 27 '19 at 12:19