Skip to content

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.

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 main
A .gitignore
$ girt diff main~2 topic --renames
M README.md
R100 src/main.rs src/lib.rs

Rename 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.

--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 --renames
diff --git a/README.md b/README.md
index ce01362..94954ab 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,2 @@
hello
+world
diff --git a/src/main.rs b/src/lib.rs
similarity index 100%
rename from src/main.rs
rename to src/lib.rs