I push to Gerrit, and my code is reviewed such that valid comments are made. I make the changes, and do a fresh commit and push, assuming that I’ve created a new patch set.
However, I forget to tick the ‘Amend commit’ box in IntelliJ:
This means that the new commit gets pushed to Gerrit with a new Change-Id, and so the change does not become associated with the previous push. Now my reviewers can’t (easily) make the connection between the 2 changes, nor can anyone who looks at this in the future.
My commit messages are multi-line, and so cannot easily be altered on the command line if I wanted to do a git amend
.
My approach has been to try and undo the ‘bad’ commit --- but I end up getting confused in Git Hell.
I end up:
- checking out origin/master into a new repo on my laptop and
manually making my changes again (yes, really), then - deactivating the commit-msg hook in my .git/hooks directory, then
- making a commit with the desired Change-Id manually added to the message, then
- pushing to Gerrit.
- Finally I re-activate the commit-msg hook
This can’t be the best way to do it. It works, but it can’t be the best way to do it.
What do?