Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to amend the contents of a commit in sourcetree's interactive rebase?

Joseph Heenan January 21, 2014

When I start an interactive rebase in sourctree, there's an option 'Amend commit?'.

I was expecting ticking this option would put me into something similar to git gui's "amend last commit" feature - I'd see what was staged, what wasn't staged, unstage hunks/lines, etc.

What actually happens is that I just get shoved into a state where I'm not sure what the state actually is. It definitely thinks it's in a rebase, but there's no files shown in the staged area of the working copy.

How do I remove a hunk from the commit that I didn't mean to commit?

1 answer

1 accepted

1 vote
Answer accepted
KieranA
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.
January 22, 2014

Hey Joseph,

The amend feature in interactive rebase allows you to drop in on any commit and make any changes, thus creating a new commit. So out of 10 commits, the 5th commit has something in it I'd like to change, so I hit amend on that one which will drop me back out to SourceTree still in a rebase mode. I can make changes and then hit commit.

At the moment SourceTree forces the 'Amend commit' checkbox in the commit sheet. This will cause the rebase process to continue once you've amended the commit you chose.

Feel free to ask more questions if you have any - we've been planning on writing a guide to this for some time.

Cheers

Joseph Heenan January 25, 2014

Thanks Kieran! At least from the perspective of someone coming from git gui, I have to say that I find sourcetree's amend commit view confusing. I'd feel far happier if the commit window showed me the final state the amended commit will end up in, whereas I believe it's showing me the changes that will be applied to the commit, if that makes sense.

anil kumar April 1, 2014

Hi May I Know how can we apply git commit --amend on 5th commited one

Actually, I able to apply $git commit --amend -m "my msg" Which effects on latest commit.

Can You tell/suggest if it possible to apply on amend on any committed message out of 10 other than latest..

Thanks in advance

Anil

Ananth SNC July 17, 2015

BRANCHES > Right Click on commit on top right table > Rebase children interactively > Edit Message .. on Mac

Like Renjie_Li likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events