Git
Git Patch
A Git patch is a file that contains the differences (or "diffs") between two versions of a repository’s files.
A patch includes the exact changes made to lines of code, making it useful for applying updates, fixes, or new features to other branches or different repositories.
Create Patch
There are 2 ways to make patch in Git
- git diff
- git format-patch
git diff
(only the current change)
git diff > some-changes.patch
format-patch
between commits
- the latest commit
git format-patch -1 HEAD
- for a range of commits
git format-patch
.. Apply Patch
There are 2 ways to apply patches
- git apply
- git am (apply multiple)
For a single patch
git apply your_patch_name.patch
For multiple patches
git am *.patch