Skip to content

Instantly share code, notes, and snippets.

@kazu69
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazu69/7ea0ae5aa4f0b838ae71 to your computer and use it in GitHub Desktop.
Save kazu69/7ea0ae5aa4f0b838ae71 to your computer and use it in GitHub Desktop.
patchのあれこれ
# http://d.hatena.ne.jp/mrgoofy33/20101019/1287500809
# http://d.hatena.ne.jp/kanonji/20110222/1298341934
# ファイル差分を取る
diff -c(or -u) file.origin file.new > diff.patch
# git で差分を取る
git diff --no-prefix > diff.patch
# HEADで差分を指定
git diff HEAD~1 --no-prefix > diff.patch
# メール用のフォーマット
git format-patch > diff.patch
# dry run 適用
patch --dry-run -p0 < diff.patch
# patch 適用
patch -p0 < diff.patch
# エラーが出たら
patch -p0 --ignore-whitespace < diff-file
# assume reversedとか聞かれなくする
patch -p0 -t --ignore-whitespace < diff-file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment