Diffs
girt diff compares two snapshots: commits, or trees named any way the revision language allows. It
never looks at the index or working tree; girt status does
that. The examples use the repository from Getting started, where
topic renamed src/main.rs. The library side is in
Diffs and renames.
Compare two trees (girt diff)
Section titled “Compare two trees (girt diff)”girt diff A B compares two commits or trees and lists each changed path with a status letter: A
added, D deleted, M modified, T type changed. --renames pairs deletions with additions
whose content is similar enough and prints them as R<similarity>; --copies also looks for
copies of modified files. --names asks for the default name list explicitly. When a large change
exceeds the rename limit, girt warns on stderr that exhaustive detection was skipped and prints the
rest of the comparison.
$ girt diff main~1 mainA .gitignore$ girt diff main~2 topic --renamesM README.mdR100 src/main.rs src/lib.rsRename detection is off unless you ask for it, unlike git diff, which follows diff.renames. With
--git, the name list matches git diff-tree -r --name-status (with -M or -C for --renames
or --copies), and --patch matches git diff --no-renames, or git diff -M with --renames.
Print a patch (girt diff --patch)
Section titled “Print a patch (girt diff --patch)”--patch prints a unified diff with three lines of context. It applies .gitattributes and
diff.<driver> settings as git diff does, but refuses a driver that needs textconv or an
external command. The line diff is plain Myers without Git’s indent heuristic, so an ambiguous hunk
can line up differently from Git’s.
$ girt diff main~2 topic --patch --renamesdiff --git a/README.md b/README.mdindex ce01362..94954ab 100644--- a/README.md+++ b/README.md@@ -1 +1,2 @@ hello+worlddiff --git a/src/main.rs b/src/lib.rssimilarity index 100%rename from src/main.rsrename to src/lib.rs