Modify Commit Message

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

0 votes
Accepted answer

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 :)

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 ...

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.

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 ...

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
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

844 views 3 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you