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?
-
Related: [Git: How to edit a commit message in SourceTree-Windows already pushed to BitBucket?](http://stackoverflow.com/questions/17604232/git-how-to-edit-a-commit-message-in-sourcetree-windows-already-pushed-to-bitbuc). – Jul 16 '13 at 05:24
3 Answers
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

- 4,884
- 1
- 16
- 15

- 19,828
- 10
- 59
- 83
-
18I really miss the "Edit log message" of TortoiseSVN. Any chance they will add such feature ? – Benoit Blanchon Sep 11 '13 at 13:49
-
Go to TortoiseGit issue tracker http://code.google.com/p/tortoisegit/issues/list to submit a feature request – linquize Oct 03 '13 at 04:47
-
3I'm lost on step 6, what do you mean by "Select from head to one commit above it " is that an option in the context menu? – Flethuseo Oct 14 '14 at 15:35
-
1lost on step 6 too. no cherry pick option anywhere, and I can't see the commit above in any case (just says working dir changes, of which there are actually none) – Robert Ivanc Dec 03 '14 at 14:22
-
Lost at step 6 too, and all of my commits after that one have been wiped away from the log. Did the code changes get lost too? Help please. – Samuel Dec 23 '14 at 03:19
-
16Downvote because I think the suggestions in the case where the commit is in the middle have caused me to discard my code changes up to that commit, which is several weeks of work. – Samuel Dec 23 '14 at 03:28
-
I believe you can retrieve the lost commits from the hard reset, see Wayne's answer here: http://stackoverflow.com/questions/2080443/how-can-i-reorder-combine-commits-using-git-rebase. – Samuel Jan 05 '15 at 17:40
-
I was able to do Linquize's steps for commit-in-the-middle without losing my later commit (I had only one) by not closing or refreshing the initial log window after the hard reset. The commit that should have been blown away remained visible in the list and I could run cherry pick in step 6 to to bring it back (mind blown). I want to add "don't close/refresh the log window!" to the instructions, but I don't understand what happened. I thought the hard reset actually removed the data from the repo, but somehow it came back. – Vimes Mar 20 '15 at 21:09
-
8WARNING: Use "Create branch at this version" to set a temporary branch name before resetting to the commit you want to modify. Otherwise, you risk losing all the commits above this point. (If this already happened to you, `git reflog` will help you to retrieve them). – Steve Pitchers Aug 11 '15 at 15:22
-
1@StevePitchers, exactly, this is something that the answer should mention in bold. – Sharique Abdullah May 19 '17 at 04:16
-
There's another toggle called "Message only" down the screen probably introduced with newer versions. That's useful when you only want to amend the message. – Baz Guvenkaya Aug 30 '17 at 07:27
-
I get that rewriting history is not a good thing and all version control systems makes it hard by default, but I dont understand why editing commit message should be hard. It need not be considered as editing history; it's not like the SHA is changing. A good commit message is always helpful, one that I sometimes need to revisit. – nawfal Nov 28 '18 at 08:24
-
@nawfal The SHA is generated using the content of the commit (including the message). So changing the message would change the SHA. – Leon Lucardie Dec 27 '22 at 16:05
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?.

- 8,063
- 8
- 45
- 41
-
9Agreed. git is taking me unbelievably long to learn how to use, SVN was so simple. The concept of git is simple, but its usage isn't. – Samuel Feb 23 '15 at 15:33
-
TortoiseGit also offers interactive rebase, you don't *need* to use the command line for this. – Peter Jun 25 '18 at 10:25
-
@Peter, if you set a friendly editor (as Notepad++) instead of vim, then the approach with command line is quite doable :) – AntonK Dec 22 '21 at 08:49
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.
- In the
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. - Click
Force Rebase
- Right-click the commit you want to edit and select the
Edit
option. You may choose to edit multiple commits. - Click the
Start Rebase
button. - Rebase will pause at the commits that you have marked for
Edit
- Click on
Commit Message
tab at the bottom and edit the message - Click the
Amend
button to continue