Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gitignore item for multiple projects

I want to ignore a path in several .git repos, but I don't want to make this global configuration. Say I have this:

projects/
    foo/
     .git/
     conf/
    bar/
     .git/
     conf/
    baz/
     .git/
     conf/

for all the projects in projects/ I want to ignore any changes to the conf folder. Is there a way to do this with

$ git config

Because this is a work thing and I share stuff with other devs, I don't want to modify the .gitignore files in each project. I need local settings only.

like image 691
Alexander Mills Avatar asked Jun 10 '26 05:06

Alexander Mills


1 Answers

According to the gitignore manual Git searches for patterns in

  • checked in .gitignore files,
  • $GIT_DIR/info/exclude (local, not committed)
  • the file pointed to by git config core.excludesFile (with $XDG_CONFIG_HOME/git/ignore being the default and ~/.config being the default for the XDG variable).

The simplest method therefore would be a global file in ~/.config/git/ignore as longs as other git repositories are not affected. Otherwise you can use $GIT_DIR/info/exclude but have to configure each repository individually.

like image 138
A.H. Avatar answered Jun 11 '26 22:06

A.H.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!