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?
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:
Scenarios 1 and 3 are fine. Scenario 2 is counter-intuitive. The outcome for scenario 2 should be the same as 3.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
"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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, but also that's just generally how I review my diffs, one file at a time.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.