As shown on this popular answer in SO, when I need to edit/correct the message for the last commit, I do:
git commit --amend -m "New commit message"
But what am I supposed to do when I want to amend commit messages for commits previous to the last one? For instance, the 14th last commit - also considering that commits have not been pushed to remote?
Is there a way of doing this without resetting previous commits? Would rebase
be the right thing to do in this case?
You would need interactive rebasing as mentioned here: How to modify a specified commit in git?
The difference being, instead of
edit
you'll just want toreword
the commit in question since you just want to edit the commit message.Here's another useful resource: https://help.github.com/articles/interactive-rebase
edit:
reword
only works on versions 1.6.6 or newer as noted by the OP.