【问题标题】:Differences between Commit, Commit Staged, and Commit All in VS CodeVS Code 中 Commit、Commit Staged 和 Commit All 的区别
【发布时间】:2021-11-01 11:48:47
【问题描述】:

在 Visual Studio Code 中有三个 Git 提交命令:

  • 提交
  • 提交分阶段
  • 全部提交

它们之间有什么区别?

很遗憾,我没有找到任何关于此的文档或网页。 (我对 git pullgit fetchcommit – amendcommit – signed off 之间的区别不感兴趣,正如大多数搜索所暗示的那样——所有这些都记录得很好. Commit 命令在德文文章Visual Studio Code (7): Git als Quellcodeverwaltung einsetzen 的综合列表中也缺少,例如)

【问题讨论】:

  • 我猜这是不同插件提供的相同的东西。卸载插件,看看会发生什么,然后一一重新安装。
  • @fredrik 在没有安装扩展的情况下会发生这种情况(你的意思是扩展,不是吗?)。

标签: visual-studio-code commit git-commit


【解决方案1】:

我通过 git 日志窗口 观察了 VS Code 的行为,发现commitcommit all 选项都记录了git 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

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

【讨论】:

    【解决方案2】:

    我尝试从我的 VS Code 实例运行“提交”,它提示我一条消息:

    没有要提交的分阶段更改。
    您想暂存所有更改并直接提交吗?

    [从不] [取消] [总是] [是]

    所以我的猜测是:它只是一个检查您的本地配置或以交互方式询问您要做什么的命令。
    最后,它应用“提交暂存”或“全部提交”。

    【讨论】:

    • 如果你发出 Commit StagedCommit All 没有任何阶段(以及选项 Git: Suggest Smart Commit i> 启用)…
    • 嗯,注意到了。无论如何,我不是 VSCode 的 git GUI 方面的专家。
    猜你喜欢
    • 2015-07-14
    • 2020-04-03
    • 2018-03-27
    • 1970-01-01
    • 2014-01-17
    • 1970-01-01
    • 2011-05-11
    • 2017-12-30
    • 1970-01-01
    相关资源
    最近更新 更多