.gitignoreを使わずにexcludeでファイルを無視する

git logo Git

プロジェクト共通でない個人的なファイルの管理とかしたい場合には、excludeファイルで管理するやり方が用意されています。

下記にも.gitignoreで扱いたくない対象のものに、というようなことが書いてあります。

Git - Plumbing and Porcelain

使い方

対象プロジェクトの.git/infoにexcludeというファイルを用意して、無視したいファイルを記載するだけです。

新規作成しなくても下記のようなファイルが用意されている場合も多いと思います。

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

.gitignoreのglobal設定などでもパス指定するだけなのであまり変わらない気がしますが、

集約せず管理したい、プロジェクト横断な設定と分けたいとかであればこちらを使うのもありかと思います。

タイトルとURLをコピーしました