combinediff
Combine unified diff patches into one
SYNOPSIS
combinediff [options] [patchfile ...]
PARAMETERS
-u
Force unified diff output (equivalent to --unified).
-p num
Strip the smallest prefix containing num leading slashes.
--unified[=lines]
Produce unified diff output with `lines` lines of context. If `lines` is omitted, the default is 3.
--text
Treat all files as text.
--ignore-whitespace
Ignore whitespace changes.
--ignore-leading-context
Ignore initial lines of context, useful when dealing with diffs including time stamps or other variable content in the context lines.
--help
Display help message.
--version
Display version information.
[patchfile ...]
One or more patch files to process. If no files are specified, standard input is used.
DESCRIPTION
The combinediff command is a powerful utility for working with patch files that contain both unified diffs and traditional diffs. It is primarily used to convert mixed diff formats within a single patch file into a unified diff format. This is useful when dealing with patches created by older systems or tools that might not support unified diffs consistently. By converting all diffs to unified format, combinediff simplifies patch application and improves readability. It processes input from standard input or specified files, analyzes each diff block, and outputs a single patch file containing only unified diffs. The command also offers features for ignoring leading context lines, making it more adaptable to various patch formats.
Furthermore, combinediff assists in handling patches that might contain multiple diffs for the same file or patches where the filename information is inaccurate or missing. It offers options to resolve these inconsistencies, ensuring a cleaner and more reliable patch application process.
USAGE EXAMPLES
Convert a mixed-format patch file to unified diff:
combinediff mypatch.diff > unified.patch
Process a patch file from standard input and force unified diff output:
cat mypatch.diff | combinediff -u > unified.patch
Ignore leading context lines:
combinediff --ignore-leading-context input.patch > output.patch