Skip to content

Instantly share code, notes, and snippets.

@nareix
Last active August 29, 2015 14:20
Show Gist options
  • Save nareix/c40d43e8052cacf658aa to your computer and use it in GitHub Desktop.
Save nareix/c40d43e8052cacf658aa to your computer and use it in GitHub Desktop.
Patching with git diff
# Source: http://tamsler.blogspot.com/2009/02/patching-with-git-diff.html
# If you want to create a patch file via "git diff"
# that can be applied using "patch -p0 < patchfile" use the following command:
git diff --no-prefix > patchfile
# then apply the patch
patch -p0 < patchfile
# If you have an existing "git diff" patch file that was created without the "--no-prefix" option,
# you can apply that patch via:
patch -p1 < patchfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment