diffutils

Examples

diff -qr -x .git ports/i3lock gitprogs/i3lock

... "briefly" compares the two directories recursively, excluding sub files / directories matching '.git'



diff -x .git -rupN original modified > path_for_original.patch

... create a patch that incorporates the changes orgiginal -> modified, excluding the .git directory



cd original && patch -p1 < ../path_for_original.patch

... apply the patch from the above example



cd original && patch -p1 -R < ../path_for_original.patch

... remove the changes applied in the example above



Argument description for diff

  • -B, --ignore-blank-lines ignore changes where lines are all blank
  • -b, --ignore-space-change ignores changes in the amount of white space
  • -N, --new-file treat absent files as empty
  • -p, --show-c-function show which C function each change is in
  • -q, --brief report only when files differ
  • -r, --recursive recursively compare any subdirectories found
  • -u, -U NUM, --unified[=NUM] output NUM (default 3) lines of unified context
  • -X exclude files that match any pattern in
  • -x exclude files that match
  • -y, --side-by-side output in two columns
  • --suppress-common-lines do not output common lines

2026-04-11 10:45:56

minicms - © 2020-2026 Simeon Simeonov