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

845 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