How do I edit an incorrect commit message with TortoiseGit?
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?.
If the commit is the head of current branch, that is easy.
- Context menu -> Git Commit
- Tick "Amend Last Commit" checkbox
- Correct your commit message
- OK
If the commit is the head of other branch, switch to that branch first.
- Context menu -> TortoiseGit -> Switch/Checkout
- Choose branch name
- OK
- Follow above 1-4 steps to amend commit message
If the commit is in the middle without any merge between head, you need to reset, amend and cherry-pick
- Context menu -> TortoiseGit -> Log
- Select the commit -> Context menu -> Reset
- Hard Reset (this will discard all work contained in commits above the selected commit as well as any un-committed changes in the working directory)
- OK
- Follow above 1-4 steps to amend commit message
- Select from head to one commit above it -> Context menu -> Cherry-pick
- Continue