Unified diff
From Just Solve the File Format Problem
Revision as of 22:56, 20 September 2025 by Anonymoususer852 (Talk | contribs)
Unified diff (or diff unified format, unified context diff, unidiff) is a diff format commonly used for patch files.
Contents |
Identification
Unlike other diff formats, Unified diff has lines that begin with "@@".
Specifications
- Unified Diff Format - Ad-hoc specification by Guido van Rossum
- GNU Diffutilis manual: Detailed Description of Unified Format
Software
- GNU Diffutils:
diff
(with-u
option),patch
- git:
git
with eithergit diff...
,git format-patch...
, orgit log -p
can be used to provide unified diff- Conversely
git apply ...
can be used to apply diff or patches that were created viagit
and that the user is inside a functional git filesystem, where top directory has a folder named.git
- Conversely
Sample files
- Example from the GNU Diffutils manual
- http://www.apache.org/dist/httpd/patches/ ...
- Updated git-remote documentation #6 in patch/diff format - GitHub - via inputting
https://github.com/git/git/pull/6.diff
into the address bar will make GitHub provide the pull request (PR) in a suitable patch/diff format
Links
- Wikipedia:Diff utility has a section on Unified diff