Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git diff --name-status : What does R100 mean?

Tags:

When I do e.g. git diff master --name-status I see some lines with the R100 prefix on them.

What does R100 exactly mean?


I would assume R means "moved". I am posting below what I found in the documentation, but nothing in this text says anything about 100 or numbers per se.

--name-status Show only names and status of changed files. See the description of the --diff-filter option on what the status letters mean.

and then

--diff-filter=[(A|C|D|M|R|T|U|X|B)…​[*]] Select only files that are Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type (i.e. regular file, symlink, submodule, …​) changed (T), are Unmerged (U), are Unknown (X), or have had their pairing Broken (B). Any combination of the filter characters (including none) can be used. When * (All-or-none) is added to the combination, all paths are selected if there is any file that matches other criteria in the comparison; if there is no file that matches other criteria, nothing is selected.

Also, these upper-case letters can be downcased to exclude. E.g. --diff-filter=ad excludes added and deleted paths.

Note that not all diffs can feature all types. For instance, diffs from the index to the working tree can never have Added entries (because the set of paths included in the diff is limited by what is in the index). Similarly, copied and renamed entries cannot appear if detection for those types is disabled.

like image 808
Amelio Vazquez-Reina Avatar asked Oct 30 '18 03:10

Amelio Vazquez-Reina


People also ask

What is a git diff?

Comparing changes with git diff Diffing is a function that takes two input data sets and outputs the changes between them. git diff is a multi-use Git command that when executed runs a diff function on Git data sources. These data sources can be commits, branches, files and more.

What is git status porcelain?

Porcelain Format Version 1 Version 1 porcelain format is similar to the short format, but is guaranteed not to change in a backwards-incompatible way between Git versions or based on user configuration. This makes it ideal for parsing by scripts.

What is the use of git status command?

The git status command displays the state of the working directory and the staging area. It lets you see which changes have been staged, which haven't, and which files aren't being tracked by Git.

How do you check changes before commit?

If you just want to see the diff without committing, use git diff to see unstaged changes, git diff --cached to see changes staged for commit, or git diff HEAD to see both staged and unstaged changes in your working tree. +1 Yes.


1 Answers

The documentation for git status under "Changed Tracked Entries" appears to explain what R100 means:

<X><score> The rename or copy score (denoting the percentage of similarity between the source and target of the move or copy). For example "R100" or "C75".

So, putting this together with what you cited above, the files you are seeing with R100 status mean that they were moved, and that Git found a 100% match between that file and some other previously named file.

Here is a link to a good @torek answer, which described the physics of how Git tracks content.

like image 103
Tim Biegeleisen Avatar answered Oct 13 '22 15:10

Tim Biegeleisen