まーぽんって誰がつけたの?

iOS→Scala→インフラなおじさん技術メモ

特定のレポジトリのローカル環境だけgitignoreする

プロジェクトごとの環境ファイルなんかで、自分のローカル環境のみの設定が入っちゃう場合に、ローカル環境だけで.gitignoreしたくなるときがある。

あとは、社内ではgit-svnしか使えないような環境で、gitignoreをコミットできない肩身の狭い人にも。。

ローカルのgitレポジトリごとに、excludeファイルというのが用意されていて、そこに書けばいけました。

excludeファイルの編集

vim .git/info/exclude

# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
<Ignore File Pattern>

gitに認識させる

これだけだと、反映されないので、

git update-index --assume-unchanged <Ignore File Path>