首页 > 解决方案 > Differences between Commit, Commit Staged, and Commit All in VS Code

问题描述

There are three commands for Git committing in Visual Studio Code:

What are the differences between them?

Unfortunately, I have not found any documentation or web pages on this. (I am not interested in the differences between git pull and git fetch or commit – amend or commit – signed off as most searches suggest – all of these are documented well. The Commit command is also missing in the comprehensive list in the German article Visual Studio Code (7): Git als Quellcodeverwaltung einsetzen, for example.)

标签: visual-studio-codecommitgit-commit

解决方案


我通过git log 窗口观察了 VS Code 的行为,我发现commitandcommit all选项都记录了 agit add -A -- .所以结果是一样的。

> git add -A -- .
> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
> git status -z -u
> git symbolic-ref --short HEAD
> git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/master refs/remotes/master
> git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname)
> git remote --verbose
> git config --get commit.template
> git ls-tree -l HEAD -- /home/antonio/tmp/vscode/f9
> git show --textconv HEAD:f9
> git status -z -u
> git symbolic-ref --short HEAD
> git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/master refs/remotes/master
> git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname)
> git remote --verbose
> git config --get commit.template

在我看来,这可能是一个错误!


推荐阅读