Patch from git diff
Create a patch file from your git diff
TLDR;
git diff --no-prefix > my.patch
git reset --hard
patch -p0 < my.patch
Step 1: Make Changes
make changes to your files
Step 2: Verify your changes
Make sure that the changes you’ve made are showing in the git diff
git status
git diff
Step 3: Create the patch
This will create a patch for ALL the changes in the git diff
output
git diff --no-prefix > my.patch
Step 4:
Reset the files to their original state.
We do this so that we can verify our patch works with a fresh code base.
git reset --hard
Step 5: Apply your patch
patch -p0 < my.patch