2

For my global gitignore, I would like to use multiple up-to-date gitignore templates from https://github.com/github/gitignore for my OS / IDEs / languages / frameworks like macOS, Java, Android, and JetBrains.

There are some solutions here to concatenate locally:

Can I include other .gitignore file in a .gitignore file? (like #include in c-like languages)

gitignore loads other gitignores

but I'm wondering if there are any more elegant solutions that simply concatenate the up-to-date templates from the specified urls.

Pat Myron
  • 4,437
  • 2
  • 20
  • 39

3 Answers3

2

The content filter driver that you reference (and that I wrote) is done automatically on checkout.

That script can do anything you want, including fetching the latest version of those remote gitignore file (through a simple curl for instance), and generate the updated concatenated file.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1
git config --global core.excludesfile ~/.gitignore

# concatenating URLs
curl https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore https://raw.githubusercontent.com/github/gitignore/master/Global/macOS.gitignore > ~/.gitignore

# alternative pre-concatenated .gitignore service
curl -sL https://www.gitignore.io/api/c,c++ > ~/.gitignore

Lines like this in my .bashrc file will run every time I launch my shell and overwrite my global .gitignore file with the latest versions of the .gitignore's from that repository

Pat Myron
  • 4,437
  • 2
  • 20
  • 39
1

I run the a project that hosts the largest amount of gitignore templates and it's extremely easy to use.

Joe
  • 1,320
  • 13
  • 11