Created
June 26, 2013 07:23
-
-
Save panghea/5865413 to your computer and use it in GitHub Desktop.
git archiveで日本語を含むファイルの差分抽出できない場合の別案 ref: http://qiita.com/panghea@github/items/84c2c14ed5d58f8dc191
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#一つ前のコミットから差分ファイルの一覧を抽出する場合 | |
$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