LoginSignup
8
9

More than 5 years have passed since last update.

[git] コミットログから差分ファイルの抽出・一覧作成の方法

Posted at

gitのリポジトリのあるフォルダ内で下記を実行する

差分ファイル(パッチ)の作成方法

git diff --no-prefix XXXXXX HEAD > ~/Desktop/patch.`date +"%Y%m%d"`.diff

※ XXXXXX : gitのコミットの番号(短い方で大丈夫のようです)

差分ファイルのファイル名のみの一覧の作成方法

git diff --stat --name-only --no-prefix XXXXXX HEAD > ~/Desktop/list.`date +"%Y%m%d"`.txt

差分ファイルのみをコピーしてzip圧縮

git archive --format=zip --prefix=archive/ HEAD `git diff --name-only --diff-filter=ACRM  XXXXXX HEAD` -o ~/Desktop/archive.`date +"%Y%m%d"`.zip

※ diff-filter 参考: http://qiita.com/usamik26/items/bfc2196f510d68b3c2cc

差分ファイル適用方法

※ patch.201601XX.diff が差分ファイルとする

dry-run(仮適用)で動作確認

patch -p0 --dry-run < patch.201601XX.diff

本適用

patch -p0 < patch.201601XX.diff
8
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
9