Add optional warning when attempting to commit single file but other files are staged
A common operation in SG is to right-click on a specific file and choose "commit". This stages (if necessary) the specific file and prepares to commit it.
However, if other files are already staged, they will be added to the commit even if that was not the intention. This fairly frequently causes accidental commits in our codebase, because the user assumes SG is going to commit only the selected file, but ends up committing other staged files as well because they forget to double-check the pre-commit dialog.
This is particularly common when lots of files are modified, because that can result in some staged files being "offscreen" in the "Files" window at the time the user selects the individual file.
SmartGit already has a similar warning when someone is submitting "staged modified" files (to ask if only the staged changes should be submitted, versus all changes), so there is precedent for this kind of helpful warning.
Example: In the image below I right-clicked on the highlighted .gitignore file to commit it. If I am in a rush and forget to check the pre-commit dialog, I'll accidentally commit 3 files instead of one.
** Alternately (and perhaps ideally) SG would just disable the "submit" button when right-clicking a single file when other files are staged but not selected. This would prevent the problem entirely.
Customer support service by UserEcho
Thanks for looking into this, Marc.
I just tried it out in the latest build (18.2 preview 6 #13110, installed: #13077) and
Here's the behavior I would like to see is that the toolbar icon ignores selection completely and operates on all files, while the right-click menu item operates solely on selected files:
Test A:
Test B: