在 gitignore 中引用多个在线 gitignore 模板

Reference multiple online gitignore templates in gitignore

对于我的全局 gitignore,我想使用来自 https://github.com/github/gitignore for my OS / IDEs / languages / frameworks like macOS, Java, Android, and JetBrains 的多个最新的 gitignore 模板。

这里有一些本地连接的解决方案:

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

gitignore loads other gitignores

但我想知道是否有任何更优雅的解决方案可以简单地连接来自指定 url 的最新模板。

content filter driver that you reference (and that I wrote) 在结帐时自动完成。

该脚本可以做任何你想做的事情,包括获取那些远程 gitignore 文件的最新版本(例如通过简单的 curl),并生成更新的串联文件。

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

每次我启动 shell 并用最新版本的 .gitignore 来自该存储库

我运行 是一个拥有最多 gitignore 模板的项目,而且它非常容易使用。