oligofren
oligofren

Reputation: 22923

What does the number in R{number} after a git rename mean?

I made the commit below. It basically shows a couple of files with static html getting renamed and moved.

commit 8449e207d529779f92bfe8b4eb2864a3f3edf69a
Author: Carl-Erik Kopseng <[email protected]>
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

What does the 076, 099 and 079 refer to? I get that R probably stands for "Rename".

Upvotes: 8

Views: 2076

Answers (1)

torek
torek

Reputation: 488153

Quoting the git diff documentation:

Status letters C and R are always followed by a score (denoting the percentage of similarity between the source and target of the move or copy). Status letter M may be followed by a score (denoting the percentage of dissimilarity) for file rewrites.

(You will only see M followed by a number if you are using the -B flag. Here is a somewhat contrived example of adding -B to cause an M status to have an appended score:

$ 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

This particular repository has 184 first-parent commits starting from HEAD:

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

with many—though not all—files appearing within the first few commits, so that comparing HEAD~182 to HEAD has many changes that result in many broken pairings when using -B.)

Upvotes: 6

Related Questions