(Git) Create & apply patch
- Create git patch file:
After making changes to source code, write contents of
git diff
to a file:git diff [--cached] [<SOURCE_FILE_SUBSET>] > <PATCH_FILE_PATH>
- Apply the patch file in another branch where needed:
git apply <PATCH_FILE_PATH>
References:
Written on March 15, 2021