git - 'delete mode 100644' 在 git 提交中意味着什么?

标签 git git-commit

我做了一个提交,我得到:

229 files changed, 16 insertions(+), 22970 deletions(-)

delete mode 100644 Foo.file
.
.
.
delete mode 100644 Bar.file

FWIW 我最近做了一些 git-worktree 工作并创建了一个新的工作树,但我认为这与此没有任何关系。

最佳答案

这里的 git commit 末尾的列表:

229 files changed, 16 insertions(+), 22970 deletions(-)

delete mode 100644 Foo.file

是在当时当前(现在是上一个)和现在当前又名 HEAD 提交上调用 git diff --stat 的结果,Git 刚刚构建了该提交将 Git 的索引写为新树并添加适当的元数据。

如果运行 git diff HEAD@{1} HEAD,您应该会看到相同的输出。您还可以使用 git diff HEAD~1 HEAD 或类似工具。

至于为什么文件 Foo.fileBar.file 等在当前提交时被省略>present 在上一次提交中:这是必要的,因为您告诉 Git 从 Git 的索引中删除这些文件。您的 git worktree 实验应该与它无关,因为每个添加的工作树都有自己单独的索引。

关于git - 'delete mode 100644' 在 git 提交中意味着什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65905772/

相关文章:

git - merge 或 rebase 任意数量的提交

python - Git diff 提示, "external diff died, stopping at ... "与我的 python diff 程序

git-commit - 为什么在不推送 git 的情况下提交?

Git日志与现实不匹配

git - 是否有可能让 git 忽略损坏的 blob

git - 如何在不授予存储库访问权限的情况下与客户共享 git 提交日志?

git 有效替换邮箱地址

git - 如何在 "git clone --depth=1"之后获取整个 git 历史记录?

空提交上的 git format-patch 返回意外结果

git - 为什么 git amend 在没有什么要修改的时候不警告你?