Reputation: 33618
How I can edit commit message with tortoiseGIT? The question is very similar to this but I want to do this with TortoiseGit not with console, is it possible?
Upvotes: 139
Views: 103828
Reputation: 759
I would say the best method to amend any commit message is to use the force rebase
option in TortoiseGit.
See this answer on How to Reorder Commits (rebase) with TortoiseGit. The same method can be used to edit commit messages.
Upstream
box choose a branch whose HEAD is some commit in your current branch history. If you don't have such a branch, create it temporarily from a commit from which you want to edit the commit messages.Force Rebase
Edit
option. You may choose to edit multiple commits.Start Rebase
button.Edit
Commit Message
tab at the bottom and edit the messageAmend
button to continueUpvotes: 23
Reputation: 8945
For the case of when the commit is in the middle, I highly recommend not following the instructions provided by linquize, see the comments below his answer for the reason.
You can use the git command line with TortoiseGit and it won't cause any problems: Can I use command-line Git tools and TortoiseGit simultaneously?.
This youtube video explains it really well: http://youtu.be/4YjKY0u9Z6I. Basically use git rebase -i and then simply "reword" the commit message.
Update: I believe you can retrieve the lost commits from the hard reset suggested by linquize, see Wayne's answer here: How can I reorder/combine commits using Git rebase?.
Upvotes: 25
Reputation: 20406
If the commit is the head of current branch, that is easy.
If the commit is the head of other branch, switch to that branch first.
If the commit is in the middle without any merge between head, you need to reset, amend and cherry-pick
Upvotes: 213