LoginSignup
61
59

More than 5 years have passed since last update.

Git でバイナリファイルを扱うときの私的設定

Posted at

Git でバイナリファイルをリポジトリに含めるときの設定。

その 1: autocrlf

$ git config --global core.autocrlf false

Git の改行コード自動変換によりファイルを壊されないようにする。

その 2: diff とらない

.gitattributes ファイルで特定の拡張子をもつファイルについて、 git diff などで diff をとらないように設定する。

*.xls -diff

ここで、 -text オプションを合わせて設定すると、その 1 で紹介した autocrlf と同じ効果を発揮する。

*.xls -diff -text

その 3: binary マクロ

その 2 で紹介した -diff -text と同じ効果を発揮する binary マクロがあり、こちらのほうがバイナリファイルであることが分かりやすいので、こちらを使う。

*.accdb binary

まとめ

  • autocrlffalse
  • .gitattributes ファイルで binary を設定

参考

61
59
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
61
59