概要
excludeファイルにローカル環境だけ無視したいファイルを登録
内容
.gitignoreはバージョン管理の対象外にしたいファイルを登録することができます。
登録した内容はリポジトリで管理し、共同で利用しているユーザーと共有出来ます。
しかし、ローカル環境のみ自分独自の設定内容を保持したいファイルがある場合で
.gitignoreでその状態を共有したくない場合があります。
そのような場合は
.git/info/exclude
にファイルを追加することでコミット対象外としつつ、他のメンバーと除外設定を
共有せずに済みます。
サンプル
myfile.txtというファイルがコミットされずに存在しています。
このファイルを.git/info/excludeに追記し、除外対象とした後に
git statusで確認を行います。
$git status # On branch master # Untracked files: # (use "git add <file>..." to include in what will be committed) # # myfile.txt nothing added to commit but untracked files present (use "git add" to track) $git status | echo $echo myfile.txt >> .git/info/exclude $cat .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] # *~ myfile.txt $git status # On branch master nothing to commit (working directory clean) $