PATCHVIEW(1)
β¨ PATCHVIEW(1) β¨
okay bestie, gather round, because this is patchview(1) from the Man pages manual, and she is a whole vibe π She's the queen bee of a little family of scripts, and she's here to make your diffs cute and numbered.
πΈ NAME πΈ
patchview, gitdiff, gitdiffview, gitshow, gitshowview, svndiff, svndiffview β no options? she shows you the numbered files that got modified by the patch. give her options? she lowkey becomes filterdiff. periodt π
π SYNOPSIS π
patchview [[-n] | [--line-number]] [[-p n] | [--strip-match=n]]
[--strip=n] [--git-prefixes=strip|keep]
[--git-extended-diffs=exclude|include] [--addprefix=PREFIX]
[[-s] | [--status]] [[-E] | [--empty-files-as-removed]]
[[-i PATTERN] | [--include=PATTERN]] [[-x PATTERN] |
[--exclude=PATTERN]] [[-z] | [--decompress]] [[-# RANGE] |
[--hunks=RANGE]] [--lines=RANGE] [[-FRANGE] | [--files=RANGE]]
[[-H] | [--with-filename]] [[-h] | [--no-filename]] [[-v] |
[--verbose]...] [file...]
patchview {[--help] | [--version] | [--filter ...] | [--grep ...]}
π¦ DESCRIPTION π¦
so likeβ¦ what even is patchview? bestie, she's a wrapper around filterdiff, built specifically for numbered files. iconic behavior honestly π
patchview
with no args at all? that's literally the same as:
lsdiff --number
and then
patchview -F2-
(or with literally any other args, no cap) is equivalent to filterdiff -F2- β or whatever arguments you hand her. she's flexible like that π«Ά
now, the family: there are 4 scripts for working with git repos β gitdiff, gitdiffview, gitshow and gitshowview β and 2 for svn β svndiff and svndiffview.
svndiff
gitdiff
no args? you get the list of files modified. that's it, that's the tea β
svndiff -F1
gitdiff -F1
this one shows the patch of file #1 π₯
svndiffview
gitdiffview
these two pipe all patches through filterdiff to vim - -R (read-only mode, which means it's easy to quit, thank u), showing you the complete patch with color. aesthetic AND functional π
svndiffview -F2
gitdiffview -F2
or any other args you feel like β this pipes the patch of file #2 to vim - -R.
gitshow
gitshowview
same energy as gitdiff, except it uses git show instead of git diff. slay β¨
π OPTIONS π
-n,--line-numberβ shows the line number where each patch begins. and if you ask for verbose output (like with-nv), every hunk of every patch gets listed too, bestie.
for each modified file, she generates a line with the line number of the beginning of the patch, then a Tab character, then the name of the modified file. if -v is given once, each of those lines gets followed by one line per hunk: a Tab character, the line number the hunk begins at, another Tab character, the string βHunk #β, and the hunk number (starting at 1).
and if -v is given twice alongside -n (so, -nvv), the format is slightly different: hunk-level descriptive text shows up after each hunk number, and the --number-files option is enabled. different flavor, same snack π
-N,--number-filesβ file numbers get listed, starting at 1, right before each filename. cute numbering moment π’-#RANGE,--hunks=RANGEβ only list hunks inside the specified RANGE. hunks are numbered from 1, and the range is a comma-separated list of numbers or βfirst-lastβ spans, optionally preceded by a modifierxwhich inverts the entire range; you can omit either the first or the last in the span to say "no limit in that direction."--lines=RANGEβ only list hunks that contain lines from the original file lying within the specified RANGE. lines are numbered from 1, and the range is a comma-separated list of numbers or βfirst-lastβ spans, optionally preceded by a modifierxwhich inverts the entire range; either the first or the last in the span may be omitted to indicate no limit in that direction.-F=RANGE,--files=RANGEβ only list files indicated by the specified RANGE. files are numbered from 1 in the order they appear in the patch input, and the range is a comma-separated list of numbers or βfirst-lastβ spans, optionally preceded by a modifierxwhich inverts the entire range; either the first or the last in the span may be omitted to indicate no limit in that direction.-pn,--strip-match=nβ when matching, ignore the first n components of the pathname. bye girl π--strip=nβ removes the first n components of the pathname before displaying it.--git-prefixes=strip|keepβ how to handlea/andb/prefixes in Git diff filenames. withstrip, she removes the prefixes both for filename matching (when you use-iand-x) and for filename output (similar to--strip). withkeep(the default), existing behavior is preserved. this applies to both Git-specific diffs (binary files, renames, mode changes) and traditional diffs when they're part of a Git patch. β οΈ note: withkeep, copy and rename operations are treated as if they hada/andb/prefixes, for consistency with other Git operations. the default will change tostripin version 0.5.0 β so heads up, bestie, the future is coming π«£--git-extended-diffs=exclude|includeβ controls whether to process Git diffs that have no traditional content hunks. this includes renames, copies, mode-only changes, and binary files. withexclude(default in 0.4.x), these diffs are skipped. withinclude(default in 0.5.0+), these diffs are processed normally. this option affects file numbering with-Nand file filtering with-F.--addprefix=PREFIXβ prefix the pathname with PREFIX before displaying it. glow-up for your paths π«-s,--statusβ shows file additions, modifications and removals. an addition gets a β+β, a removal gets a β-β, and a modification gets a β!β. visual language, love her.--empty-files-as-absent,--empty-files-as-removedβ treat empty files as absent for the purposes of displaying additions, modifications and removals. for example, a file with an empty old version and additions in the new version gets treated as a file addition (+) rather than a modification (!). β οΈ note: forgrepdiff, only the long form is available (-Emeans--extended-regexpforgrepdiff). different script, different rules, iykyk.-iPATTERN,--include=PATTERNβ include only files matching PATTERN. gatekeeping, but make it useful β-xPATTERN,--exclude=PATTERNβ exclude files matching PATTERN. not you, not today π«-z,--decompressβ decompress files with extensions.gzand.bz2.-H,--with-filenameβ print the name of the patch file containing each patch.-h,--no-filenameβ suppress the name of the patch file containing each patch.-v,--verboseβ verbose output. for the git and svn wrapper scripts (gitdiff,gitdiffview,gitshow,gitshowview,svndiff,svndiffview), this option shows the full command that's being executed. full transparency, we love that π--helpβ display a short usage message.--versionβ display the version number ofpatchview.--filterβ behave likefilterdiff(1)instead.--grepβ behave likegrepdiff(1)instead.
π SEE ALSO π
lsdiff(1), filterdiff(1), grepdiff(1)
π EXAMPLES π
okay so we can make this one-line script called difftotrunk.sh, to view the differences of two directories or svn repos (trunk and .):
diff ../trunk . -ru -x .svn | patchview "$@"
and then, bestie:
./difftotrunk.sh
will show all different files and his number. π
./difftotrunk.sh -F3,4
will show the differences of files #3 and #4 only.
./difftotrunk.sh -F3 -#1
will show only hunk #1 of file #3.
./difftotrunk.sh -F3 -#x1
will show the differences of file #3 without hunk #1 (x means that exclude, remember?).
π AUTHOR π
Tim Waugh <twaugh@redhat.com>
- Package maintainer
and that's the whole page, bestie!! π This diva lives in patchutils, and this particular version is dated 02 Jul 2020. she's still serving looks. slay, goodbye, mwah πβ¨
π¦ where this page comes from
- alpine 3.24: patchutils-doc 0.4.5-r0 Β· GPL-2.0-or-later
- arch rolling: patchutils 0.4.5-1 Β· GPL-2.0-only
- ubuntu stonking: patchutils 0.4.5-1ubuntu1 Β· 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