Sourcetree: Disable "all files selected by default" in mercurial commit dialog?

When I have several files with changes, but only want to commit two, I can simply select those two items in the changed files pane and those are the ones that are selected in the commit dialog

When I only want to commit one file, if I repeat these steps, all of the files in the commit dialog will be selected, rather than the one that is highlighted.

Is there a way to disable the "all files selected by default" behaviour?

1 answer

You can right click the single file and select 'Commit' to just commit a single file, or use the 'Commit Selected' option in the Repository menu, which has a keyboard shortcut of Cmd-Alt-C.

About the default behaviour - SourceTree assumes that when you select just a single file, you're browsing but probably still want to commit everything, but when you select more than one, you're looking for a context action. The Commit Selected action disables those 'smarts' and always does the selection.

Cmd-Alt-C solves my workflow problem. Thanks!

There's still a usability problem with the behaviour though. There appear to be three scenarios for translating selections to the commit dialog:

  1. User selects no files, presses commit button. Outcome: all files checked.
  2. User selects one file, presses commit button. Outcome: all files checked.
  3. User selects many files, presses commit button. Outcome: only selected files are checked.

Scenarios 1 and 3 are fine. Scenario 2 is counter-intuitive. The outcome for scenario 2 should be the same as 3.

I actually disagree with that. This is because I *always* have one file selected in the file view (it's the default, and I also use it for browsing diffs), but I also want to commit everything 99.9% of the time regardless of this. Having to Cmd-A to extend the file selection before committing every time would be a major PITA to me. That's why the behaviour is like it is. For selections of 2+ files, it's obvious that the sub-selection was deliberate and not just a by-product of browsing.

If you prefer the alternate approach, then you can customise the toolbar by right-clicking and selecting Customize Toolbar..., then dragging off the 'Commit' button and replacing it with 'Commit Selected'. You can also use the Cmd-Alt-C shortcut, and you can also right-click and select 'Commit' which also ties to the selection even at 1 file.

"This is because I *always* have one file selected in the file view" - is this so that the first file's diff is displayed by default?

Yes, but also that's just generally how I review my diffs, one file at a time.

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

710 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