I want to change the last commit content.
I can do local changes.
and then execute
git commit --amend
I can also do the following:
git rebase -i HEAD~
choose the commit to edit.
do local changes
and then execute:
git rebase --continue
- is there a difference between these two commands in this scenario ?
- in the context of Gerrit, when gerrit’s CHANGE-ID is involved ?
No. They both use the previous commit as a template to generate a new commit. The Gerrit change-id is simply tracked by the line in the commit comment so provided you don’t modify or remove that line Gerrit can still track this new commit as referring to that change.