LoginSignup
138
97

More than 5 years have passed since last update.

まだ .gitconfig に core.excludesfile を設定しているの?

Last updated at Posted at 2016-10-25

グローバルな .gitignore を設定するとき、よくある記事の説明が、

[core]
    excludesfile = /home/${USER}/.gitignore_global

をして、 ${HOME}/.gitignore_global を置くと。

ダメなんだよ・・・・・・!そういうのが実にダメ・・・・!せっかくgitconfigをスカッとしようって時に・・・・その横着は傷ましすぎる・・・・・・・・!

man gitignore を見ると

Patterns which a user wants Git to ignore in all situations (e.g., backup or temporary
files generated by the user’s editor of choice) generally go into a file specified by
core.excludesFile in the user’s ~/.gitconfig. Its default value is
\$XDG_CONFIG_HOME/git/ignore. If \$XDG_CONFIG_HOME is either not set or empty,
\$HOME/.config/git/ignore is used instead.

曰く、core.excludesFile のデフォルト値は $XDG_CONFIG_HOME/git/ignore$XDG_CONFIG_HOMEが空の時は $HOME/.config/git/ignore が使われます。特別な理由が無い限り、 $HOME/.config/git/ignore にグローバルな設定を置くのがgitの流儀となります。

なおグローバルなgitignoreは、GitHubのリポジトリを参考にすると幸せになります。
https://github.com/github/gitignore/tree/master/Global

138
97
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
138
97