git重命名后R {number}中的数字是什么意思?

时间:2016-11-20 08:20:57

标签: git rename

我在下面做了提交。它基本上显示了一些静态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可能代表“重命名”。

1 个答案:

答案 0 :(得分:5)

引用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时出现许多损坏的配对。)