Skip to content

Instantly share code, notes, and snippets.

@zeuxisoo
Created May 19, 2011 04:15
Show Gist options
  • Save zeuxisoo/980174 to your computer and use it in GitHub Desktop.
Save zeuxisoo/980174 to your computer and use it in GitHub Desktop.
How to use git diff to patch file

Create patch file

git diff --no-prefix > [path file name]

Apply path file

patch -p0 < [path file name]

@williamdes
Copy link

patch -p1 < patch.diff worked for me !
Thank you @crzdeveloper

@TFLBA
Copy link

TFLBA commented Nov 14, 2019

Where do you put it and what it does

@ehsanhoushmand
Copy link

or even more easier
git apply patch.diff

@jiacai2050
Copy link

@teamus2012
https://medium.com/odds-team/create-a-patch-file-from-git-diff-c746be60d1e

Thanks, great post explains what p1 means.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment