HG(DIFF)
π
HG(DIFF) β like, the hg diff manual page, but make it make sense β¨
okay bestie, sit down, we're learning hg diff and honestly? it's giving essential. no cap.
πΈ NAME πΈ
hg diff β diff repository (or selected files) π¦
β¨ SYNOPSIS β¨
hg diff [OPTION]... ([-c REV] | [--from REV1] [--to REV2]) [FILE]...
π DESCRIPTION π
Show differences between revisions for the specified files. that's the whole vibe, that's the assignment. π
Differences between files are shown using the unified diff format. iconic behavior fr fr.
Note βhg diffmay generate unexpected results for merges, as it will default to comparing against the working directory's first parent changeset if no revisions are specified. To diff against the conflict regions, you can use--config diff.merge=yes. π so like, heads up.
By default, the working directory files are compared to its first parent. To see the differences from another revision, use --from. To see the difference to another revision, use --to. For example, hg diff --from .^ will show the differences from the working copy's grandparent to the working copy, hg diff --to . will show the diff from the working copy to its parent (i.e. the reverse of the default), and hg diff --from 1.0 --to 1.2 will show the diff between those two revisions. so many options bestie, we're literally spoiled π
Alternatively you can specify -c/--change with a revision to see the changes in that changeset relative to its first parent (i.e. hg diff -c 42 is equivalent to hg diff --from 42^ --to 42) π§
Without the -a/--text option, diff will avoid generating diffs of files it detects as binary. With -a, diff will generate a diff anyway, probably with undesirable results. π yeah that's the messy part, don't say I didn't warn you.
Use the -g/--git option to generate diffs in the git extended diff format. For more information, read hg help diffs. π
Examples: β
- compare a file in the current working directory to its parent:
hg diff foo.c
- compare two historical versions of a directory, with rename info:
hg diff --git --from 1.0 --to 1.2 lib/
- get change stats relative to the last change on some date:
hg diff --stat --from "date('may 2')"
- diff all newly-added files that contain a keyword:
hg diff "set:added() and grep(GNU)"
- compare a revision and its parents:
hg diff -c 9353 # compare against first parent
hg diff --from 9353^ --to 9353 # same using revset syntax
hg diff --from 9353^2 --to 9353 # compare against the second parent
Returns 0 on success. π«Ά
π OPTIONS π
-r,--rev <REV[+]>β revision (DEPRECATED) π like it still works but it's on its way out, don't build your whole personality on it--from <REV1>β revision to diff from--to <REV2>β revision to diff to-c,--change <REV>β change made by revision--ignore-changes-from-ancestorsβ only compare the change made by the selected revision (EXPERIMENTAL) π§ͺ handle with care bestie-a, --textβ treat all files as text-g, --gitβ use git extended diff format (DEFAULT:diff.git)--binaryβ generate binary diffs in git mode (default)--nodatesβ omit dates from diff headers--noprefixβ omita/andb/prefixes from filenames-p, --show-functionβ show which function each change is in (DEFAULT:diff.showfunc)--reverseβ produce a diff that undoes the changes π-w, --ignore-all-spaceβ ignore white space when comparing lines-b, --ignore-space-changeβ ignore changes in the amount of white space-B, --ignore-blank-linesβ ignore changes whose lines are all blank-Z, --ignore-space-at-eolβ ignore changes in whitespace at EOL-U,--unified <NUM>β number of lines of context to show--statβ output diffstat-style summary of changes--root <DIR>β produce diffs relative to subdirectory-I,--include <PATTERN[+]>β include names matching the given patterns-X,--exclude <PATTERN[+]>β exclude names matching the given patterns-S, --subreposβ recurse into subrepositories
[+] marked option can be specified multiple times β so yes, you can spam it, she's flexible like that π
okay that's the whole page bestie, you ate that. π
this has been HG(DIFF) from the Mercurial manual, and yeah the version and date live up in that footer header zone, but consider this your cute lil sign-off instead πβ¨π go forth and diff, main character π¦π
π¦ where this page comes from
- arch rolling: mercurial 7.2.4-1 Β· GPL
- fedora 43: mercurial 7.1.1-1.fc43 Β· GPL-2.0-or-later
- fedora 43: mercurial 7.1.1-2.fc43 Β· GPL-2.0-or-later
- fedora 44: mercurial 7.2-1.fc44 Β· GPL-2.0-or-later
- fedora 44: mercurial 7.2.4-1.fc44 Β· GPL-2.0-or-later
- nixos 26.05: mercurial 7.1.2
- nixos 26.05: mercurial-full 7.1.2
- nixpkgs unstable: mercurial 7.2.2
- nixpkgs unstable: mercurial-full 7.2.2
- opensuse-leap 16.0: mercurial 7.0.1-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: mercurial 7.0.1-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: mercurial 7.0.1-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: mercurial 7.0.1-160000.2.2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms