git 记录“.../{ => Folder}/...”是什么意思?

git log what does ".../{ => Folder}/..." mean?

我正在查看大量 b运行ch 协调回购(大量合并和 b运行ching)的 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 差异没有任何帮助,我认为这是一个子文件夹替换?不确定。

有什么想法吗?

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

The git diff isn't any help, I think it's a sub folder replace? Not sure.

您正在查看 的输出是 git diff(内置于 git log),您是对的。这是在总结某些提交 L(位于左侧)和其他一些提交 之间的差异时显示文件夹(目录)名称更改的 shorthand 方式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 有更灵活的内部文件命名系统。)