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

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

Blake Williams June 26, 2012

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

1 vote
stevestreeting
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 26, 2012

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.

Blake Williams June 27, 2012

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
stevestreeting
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 27, 2012

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.

Blake Williams June 27, 2012

"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?

stevestreeting
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 27, 2012

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

Matt Arnold July 2, 2019

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
TAGS
AUG Leaders

Atlassian Community Events