微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

git log ".../{ => Folder}/..." 是什么意思?

如何解决git log ".../{ => Folder}/..." 是什么意思?

我正在查看一个重型分支协调存储库(大量合并和分支)的 git 日志,当我运行我方便的 git log 别名时:git log --stat --pretty=short --graph

我看到了这个奇怪的语法:

| | |  application/client/app/Admin/Templates/index.tsx                            |   2 +-
| | |  application/client/app/Awards/Templates/Create.tsx                          | 126 ++++++++++++++++++++++++++++++++++++++++++++++++

# here
| | |  application/client/app/Awards/{ => Templates}/Templates.scss                |   0
| | |  application/client/app/Awards/{ => Templates}/Templates.tsx                 |  12 ++---

| | |  application/client/app/components/DataTable/IndeterminateCheckBox/index.tsx |  10 ++--
| | |  application/client/app/components/DataTable/index.tsx                       | 258 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
| | |  application/client/app/components/DataTable/styles.scss                     |  96 +++++++++++++++++++++++++++++++------
| | |  application/client/app/components/DropDownMenu/DropDownMenu.scss            |  26 +++++-----
| | |  application/client/app/components/DropDownMenu/index.tsx                    |  56 +++++++++++-----------
| | |  application/client/app/components/Header/Header.scss                        |  13 +++--
| | |  application/client/app/components/Header/index.tsx                          |  65 ++++++++++++++-----------
| | |  application/client/app/components/Inputs/Inputs.scss                        |  74 ++++++++++++++++++----------
| | |  application/client/app/components/Inputs/index.tsx                          |  58 +++++++++++++---------

git diff 没有任何帮助,我认为它是一个文件夹替换?不确定。

有什么想法吗?

解决方法

这实际上来自 git diff --stat--statgit log --stat 选项会调用它。

git diff 没有任何帮助,我认为它是一个子文件夹替换?不确定。

您正在查看的输出来自 git diff(内置于 git log),您是正确的。这是在总结某些提交 L(放置在左侧)和其他一些提交 R(放置在对)。由于 git log 正在比较父子提交对,L(左侧)提交是父提交——在子提交之前的旧提交——以及 R(右侧)提交是紧跟在该父项之后的子项。 Git 能够匹配一个名为:

application/client/app/Awards/Templates.scss

L 提交中针对一个名为:

application/client/app/Awards/Templates/Templates.scss

R 提交中。

请注意,您可以运行:

git diff --stat <left-side-commit-ID> <right-side-commit-ID>

你自己,得到同样的输出;在这种情况下,您可以选择任意两个您喜欢的提交。假设一些非常旧的提交具有散列 ID a123456,而一些最近的提交具有散列 ID 07fbdad。然后:

git diff --stat a123456 07fbdad

将向您展示如何更改 a123456 的内容以匹配 07fbdad 的内容的此类摘要。这是有效的,因为每个提交都有每个文件的完整快照,这是 Git 在您或任何人进行提交时知道的。

对于在左侧提交之前的提交(例如,父文件的父文件),文件可能具有较旧的名称。对于之后的提交,该文件可能具有更新的名称。

(从某种意义上说,Git 根本没有真正的文件夹。这些文件只是以非常长的名称存储,其中包括嵌入的斜杠。但 Git 知道您的操作系统要求这些是被视为文件夹和文件名,即一系列以斜线分隔的名称​​组件,因此它试图适应这一点,即使 Git 具有更灵活的内部文件命名系统。)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。