How to commit a part of a file

I'm using SourceTree 1.9.3.1 with Mercurial on Mac OSX 10.9.3.

I come from TortoiseHg on Windows, where it is possible to select the exact lines I want to commit within a file. Any unselected lines are available for selection on the next commit.

Sadly THg isn't supported on Mac. How can I make SourceTree behave in this way?

2 answers

Firstly, you should turn on the staging area (I believe it is off by default in 1.9). Once you have it on, you can select lines to stage in the diff view of each uncommitted file. Then you commit what is in staging.

Hi Seth,

Where is the staging area option? I can see an option to stage files in the Git settings but not in the Hg settings.

I only use Git, but now that you mention it, I remember reading somewhere that Staging is a Git-specific concept. I guess I have no idea how you'd pull it off in Hg.

You might still try highlighting lines in the diff view to see if any extra options are presented (as buttons above or below the hunk).

I don't mean something at the source control level, I mean something in the interface level that just lets you commit only selected changes. If staging is a Git concept then that's overkill - the TortoiseHg feature works only in the UI and isn't part of Mercurial.

There are no options if I select lines in the diff view.

Back to trying to get TortoiseHg to run on Mac...

Hi Seth,

Where is the staging area option? I can see an option to stage files in the Git settings but not in the Hg settings.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

649 views 0 4
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