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

How to commit a part of a file

Alexis Sanchez June 3, 2014

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

0 votes
Alexis Sanchez June 3, 2014

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.
0 votes
Seth
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.
June 3, 2014

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.

Alexis Sanchez June 3, 2014

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.
Seth
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.
June 3, 2014

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

Alexis Sanchez June 3, 2014

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events