VS Code has a feature called "Smart Commits", which is probably what you're running into here.
There are two/three settings of relevance:
git.enableSmartCommit
: "Commit all changes when there are no staged changes." (default: false
)
git.suggestSmartCommit
: "Suggests to enable smart commit (commit all changes when there are no staged changes)." (default: true
)
Probably what you want is to do is to keep git.enableSmartCommit
at its default value of false
(I.e. don't allow commits when nothing has been manually staged for commit) and set git.suggestSmartCommit
to false
(I.e. don't ever prompt to change git.enableSmartCommit
to true
when attempting to commit before anything has been manually staged).
Once you do that, the next time you try to perform a commit action in VS Code without any staged changes, you'll get a notification saying "There are no changes to commit. Source: Git (Extension)", with a button allowing you to "Create Empty Commit" (if you want to).
Note that there's also a git.smartCommitChanges
setting, but it isn't relevant here, since you don't want the smart commit feature, and it's really only relevant when you do want the smart commit feature. But for informational purposes:
git.smartCommitChanges
: "Control which changes are automatically staged by Smart Commit." values:
"all"
: "Automatically stage all changes." (default)
"tracked"
: "Automatically stage tracked changes only."
Matt Bierner (one of the VS Code maintainers) has made an explanatory video about the "Smart Commit" feature here.
If you like reading about tool history, see https://code.visualstudio.com/updates/v1_70#_action-button-improvements.