git: modify specific commit
You can use git rebase. For example, if you want to modify commit COMMIT, run:
git rebase --interactive COMMIT^
Please note the caret ^ at the end of the command, because you need actually to rebase back to the commit before the one you wish to modify.
In the vim editor, modify pick to edit in the line mentioning 'COMMIT'.
Save the file and exit: git will interpret and automatically execute the commands in the file. You will find yourself in the previous situation in which you just had created commit COMMIT.
At this point, COMMIT is your last commit and you can easily amend it: make your changes and then commit them with the command:
git add CHANGEDFILE
git commit --amend '-S'
After that, type:
git rebase --continue
to return back to the previous HEAD commit.
WARNING: Note that this will change the SHA-1 of that commit as well as all children -- in other words, this rewrites the history from that point forward. You can break repos doing this if you push using the command git push --force.
No comments to display
No comments to display