Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   git-diff-index    ( 1 )

сравните дерево с рабочим деревом или индексом (Compare a tree to the working tree or index)

Формат вывода raw (Raw output format)

The raw output format from "git-diff-index", "git-diff-tree", "git-diff-files" and "git diff --raw" are very similar.

These commands all compare two sets of things; what is compared differs:

git-diff-index <tree-ish> compares the <tree-ish> and the files on the filesystem.

git-diff-index --cached <tree-ish> compares the <tree-ish> and the index.

git-diff-tree [-r] <tree-ish-1> <tree-ish-2> [<pattern>...] compares the trees named by the two arguments.

git-diff-files [<pattern>...] compares the index and the files on the filesystem.

The "git-diff-tree" command begins its output by printing the hash of what is being compared. After that, all the commands print one output line per changed file.

An output line is formatted this way:

in-place edit :100644 100644 bcd1234 0123456 M file0 copy-edit :100644 100644 abcd123 1234567 C68 file1 file2 rename-edit :100644 100644 abcd123 1234567 R86 file1 file3 create :000000 100644 0000000 1234567 A file4 delete :100644 000000 1234567 0000000 D file5 unmerged :000000 000000 0000000 0000000 U file6

That is, from the left to the right:

1. a colon.

2. mode for "src"; 000000 if creation or unmerged.

3. a space.

4. mode for "dst"; 000000 if deletion or unmerged.

5. a space.

6. sha1 for "src"; 0{40} if creation or unmerged.

7. a space.

8. sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree".

9. a space.

10. status, followed by optional "score" number.

11. a tab or a NUL when -z option is used.

12. path for "src"

13. a tab or a NUL when -z option is used; only exists for C or R.

14. path for "dst"; only exists for C or R.

15. an LF or a NUL when -z option is used, to terminate the record.

Possible status letters are:

• A: addition of a file

• C: copy of a file into a new one

• D: deletion of a file

• M: modification of the contents or mode of a file

• R: renaming of a file

• T: change in the type of the file

• U: file is unmerged (you must complete the merge before it can be committed)

• X: "unknown" change type (most probably a bug, please report it)

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.

<sha1> is shown as all 0's if a file is new on the filesystem and it is out of sync with the index.

Example:

:100644 100644 5be4a4a 0000000 M file.c

Without the -z option, pathnames with "unusual" characters are quoted as explained for the configuration variable core.quotePath (see git-config(1)). Using -z the filename is output verbatim and the line is terminated by a NUL byte.