【问题标题】:git log what does ".../{ => Folder}/..." mean?git log “.../{ => 文件夹}/...” 是什么意思?
【发布时间】:2021-02-23 20:26:38
【问题描述】:

我正在查看一个繁重的分支协调回购(大量合并和分支)的 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 version-control git-log


    【解决方案1】:

    这实际上来自git diff --stat--stat 选项到git 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 具有更灵活的内部文件命名系统。)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-25
      • 2016-12-02
      • 1970-01-01
      • 2017-12-21
      • 1970-01-01
      相关资源
      最近更新 更多