Preface
Due to the need for work, changes based on the source code often need to play a variety of patches on the GIT branch to solve a variety of problems. Here are two ways to generate patches and patch.
git diff
This is a patch under UNIX, generated by the git diff command under the Git branch. The specific commands are as follows:
git diff > diff.patch
For the patch generated by Git diff, you can merge with the following two commands:
git apply diff.patch
Or
patch -p1 < diff.patch
git format-patch
Git-specific patches are generated through Git format-patch. The usual methods are as follows:
- Git Format-patch-n (-n represents the patch to generate the most recent n commits)
- Git format-patch commit-id-1 commit-id-2 (Build node 1 Patch relative to Node 2)
Git-specific patches are directly through the git am command merge.
0001-....-patch
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Git Patch generation and use