【问题标题】:Reference multiple online gitignore templates in gitignore在 gitignore 中引用多个在线 gitignore 模板
【发布时间】:2018-08-07 01:06:52
【问题描述】:

对于我的全球 gitignore,我想为我的操作系统/IDE/语言/框架使用来自https://github.com/github/gitignore 的多个最新 gitignore 模板,例如macOSJavaAndroid 和@987654325 @。

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

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

gitignore loads other gitignores

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

【问题讨论】:

    标签: git github gitignore package-managers


    【解决方案1】:

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

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

    【讨论】:

      【解决方案2】:

      我运行了一个托管最多 gitignore 模板的项目,它非常易于使用。

      【讨论】:

        【解决方案3】:
        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
        

        我的.bashrc 文件中这样的行将在我每次启动我的shell 并使用该存储库中.gitignore 的最新版本覆盖我的全局.gitignore 文件时运行

        【讨论】:

          猜你喜欢
          • 2015-04-21
          • 2020-05-27
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2023-03-03
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多