Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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.

Like Matt Arnold likes this

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.

I'm with Blake on this - it's very counter intuitive and the deselection behaviour has cost me work.  If it would just behave like Windows Explorer's File Selection it would avoid a lot of confusion.

I've had it where I've staged some items, then single left-clicked on an unstaged item then right-clicked, clicked Discard and subsequently lost all of the staged changes along with the unstaged change I selected!

I'm also now in a situation where I only want to stage some changes but have been Ctrl+clicking through the changes to see which ones I want to stage.  However, anything I've Ctrl+clicked I now can't deselect by normally clicking something else!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published 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...

7,045 views 5 13
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you