【问题标题】:What does the number in R{number} after a git rename mean?git rename 后 R{number} 中的数字是什么意思?
【发布时间】:2017-04-03 18:38:15
【问题描述】:

我在下面进行了提交。它基本上显示了几个带有静态 html 的文件被重命名和移动。

commit 8449e207d529779f92bfe8b4eb2864a3f3edf69a
Author: Carl-Erik Kopseng <carl-erik@company.no>
Date:   Sat Nov 19 14:40:47 2016 +0100

    Integrate static html into epi blocks as partials

R079    Web/Views/Shared/Blocks/ChristmasLotteryBlock.cshtml    Web/Views/Shared/Blocks/ChristmasLotteryBlock/Index.cshtml
R076    Web/Static/blocks/_block_christmas-lottery-intro.html   Web/Views/Shared/Blocks/ChristmasLotteryBlock/_intro.cshtml
R099    Web/Static/blocks/_block_christmas-lottery-popup.html   Web/Views/Shared/Blocks/ChristmasLotteryBlock/_popup.cshtml
M       Web/Web.csproj

076、099 和 079 指的是什么?我知道 R 可能代表“重命名”。

【问题讨论】:

    标签: git rename


    【解决方案1】:

    引用the git diff documentation:

    状态字母 C 和 R 后面总是跟一个分数(表示 移动的源和目标之间的相似性百分比或 复制)。状态字母 M 后面可以跟一个分数(表示 差异百分比)用于文件重写。

    (如果您使用 -B 标志,您只会看到 M 后跟一个数字。这是添加 -B 以使 M 状态具有附加分数的有点做作的示例:

    $ git diff --raw -M HEAD~182 | grep 'M[0-9]'
    $ git diff --raw -B -M HEAD~182 | grep 'M[0-9]'
    :100644 100644 2b1487d... bdb5579... M074   Makefile
    :100644 100644 b639986... 8d8ebfe... M067   fcall.h
    :100644 100644 bc4f828... 2e07ef6... M060   lib9p.h
    :100644 100644 f9b5d18... 15e1ae8... M066   request.c
    

    这个特定的存储库有 184 个从 HEAD 开始的第一父提交:

    $ git rev-list --count --first-parent HEAD
    184
    

    在前几次提交中出现了许多(尽管不是全部)文件,因此比较 HEAD~182HEAD 有许多变化,导致在使用 -B 时出现许多损坏的配对。)

    【讨论】:

    • 什么是-B?我在git help status 的任何地方都看不到该选项。不仅如此,字符“-B”的组合根本不在那个页面上。
    • @trysis: git status 不提供中断配对选项;这仅在其他 git diff 前端可用。该问题没有说明 OP 使用哪个命令来获取他显示的输出(尽管我猜它是git show --stat确实提供了-B)。
    猜你喜欢
    • 1970-01-01
    • 2013-07-08
    • 1970-01-01
    • 2017-05-25
    • 1970-01-01
    • 2016-07-14
    • 2011-12-09
    • 2020-04-19
    • 2015-12-27
    相关资源
    最近更新 更多