Skip to content

Instantly share code, notes, and snippets.

@panghea
Created June 26, 2013 07:23
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 panghea/5865413 to your computer and use it in GitHub Desktop.
Save panghea/5865413 to your computer and use it in GitHub Desktop.
git archiveで日本語を含むファイルの差分抽出できない場合の別案 ref: http://qiita.com/panghea@github/items/84c2c14ed5d58f8dc191
#一つ前のコミットから差分ファイルの一覧を抽出する場合
$diff = "HEAD~1"
#日本語ファイル名の文字化けを防ぐため一時的にコンソールをutf-8に変更
$enc = [console]::OutputEncoding;
[console]::OutputEncoding = [text.encoding]::utf8
$targets = invoke-expression "git diff --name-only $diff | % -begin {`$script:a = `"`";} -proc {`$script:a += `"'`" + `$_ + `"' `" } -end {`$script:a}";
[console]::OutputEncoding = $enc;
#ファイルの圧縮を実行
invoke-expression "``7z a update_files.zip $targets"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment