the commit I would like to change its message is already pushed and it is in the middle of 5 commits. Is there any way to edit the commit message? What happend after editing, when somebody has already pulled the commit?
As this is tagged with tortoisegit, I will show you how you could achieve this in TortoiseGit
Update: updated this answer to start from the log. It isn't easier, but it's better and will not result in conflicts
It is generally not advisable to alter commits that are already publicly availabe. As you realized yourself, editing such a commit when someone else is already working on top of it may lead to conflicts when the other person tries to publish their work.
Having said that, git rebase -i HEAD~5
will allow you to interactively rebase your last five commits. It will open a ToDo file in your editor that allows yout to rewrite your history as needed. Among others, there will be a reword
option, allowing you to change the commit message for a particular commit. You just have to change the pick
in front of said commit to reword
and save the file, and git will promt you for the new commit message.
Be aware, hoever, that you will create an entirely new commit, and if you want to publish it, you will have to push with the --force
option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With