Modify Commit Message

Fahim Farook October 22, 2012

Is there a way to modify the commit message for the current commit using SourceTree? Currently, I have to go to the command-line and run the following:

git commit --amend -m "New Message"

2 answers

1 accepted

1 vote
Answer accepted
stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 22, 2012

Yeah, you can do this: there's a checkbox at the bottom left of the Commit dialog which says 'Amend latest commit', when you check it the previous message will appear in the box and you can edit it, then hit Commit to modify it. You can even change the contents of the commit if you want (file changes). Obviously make sure you haven't pushed your changes before using this :)

Fahim Farook October 22, 2012

Ah, thanks Steve :) That's exactly what I was looking for. I thought I remembered that being there somewhere but just couldn't find it when I searched ...

0 votes
MikeL
Contributor
October 22, 2012

IIRC, this command has the disadvantage to also commit staged files. If you want to only edit the last commit message without touching the index or working tree, it will be a little bit more complicated.

Fahim Farook October 22, 2012

You say it will be a "little bit more complicated" but you don't actually mention if it's possible to do so with SourceTree :) And if it is possible, how to do it ...

MikeL
Contributor
October 22, 2012

If you want to change the last commit's message without touching the index or working tree, you need to create a temp file, amend-commit this addition, remove the file and amend-commit this removal with the new message.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events