It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

SourceTree can't amend last commit

Dmitri Makarov Aug 04, 2012

Hello,

When I commit to a mercurial repository, SourceTree commit window doesn't have the checkbox for amending the last commit.

How can I amend the last commit?

Regards,

Dmitri

1 answer

1 accepted

4 votes
Answer accepted
Steve Streeting Aug 04, 2012

Mecurial doesn't actually have the 'amend commit' feature, but it has another feature which you can use.

In Mercurial, you can 'strip' commits, which SourceTree exposes in the log view context menu. If you right-click a commit and choose 'Strip from here', it will destroy that commit at all of its children. However, if you check the box 'Do not modify working copy', you can keep all the changes, and they will become uncommited changes which you can then commit again. So this is similar to the idea of 'amend last commit' if you use it on the latest commit and check the 'Do not modify working copy' box (very important!), then commit again, although Mercurial does this a bit differently.

Dmitri Makarov Aug 04, 2012

Thank you for the answer. I agree what you suggest would work. However, mercurial actually does support amend. Here's a quote from online help for hg commit command:

The --amend flag can be used to amend the parent of the working directory

with a new commit that contains the changes in the parent in addition to

those currently reported by "hg status", if there are any.

Perhaps, internally it indeed strips the parent commit and commits the combined changes of the parent commit and working directory, but it doesn't matter much for me what's behind the scene.

I assumed SourceTree would be able to do the same without me having to do two operations (strip and commit) instead of one (amend parent commit), but, apparently, it's not.

Steve Streeting Aug 04, 2012

Ah OK, this appears to be a new feature in hg 2.2, it wasn't supported before that. We still support system Mercurial versions prior to 2.2 but we may add this option in future then.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Sourcetree

[dev team] Sourcetree for Windows 2019 Preview - Dark Theme

Hi folks, While the full post is over on our blog I'd like to share the dark theme we've got planned for 2019 here directly as well to keep the discussion going.  The ...

1,952 views 14 18
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you