macOS and Linux one-liner
获得默认的 Git 忽略而不干扰创建/ 复制/ spaste 的简单方法就是从终端中使用 < code> curl 命令。 首先, < code> cd 进入您的工程根目录, 然后运行命令, 从以下两个来源中以您的 API 名称替换 < code> My_ API_ NAME :
curl -o .gitignore https://www.toptal.com/developers/gitignore/api/MY_API_NAME
您可以从列表 < a href=> 中查找您的 API 名称 。 这里 并点击 Generate 。
Java 示例:
curl -o .gitignore https://www.toptal.com/developers/gitignore/api/java
或者,您也可以在 GitHub 上使用这些文件。找到您的 API < a href="https://gitub.com/github/gitiignore" rel= “no follown noreferrer" >这里的 API < a href="。
curl -o .gitignore https://raw.githubusercontent.com/github/gitignore/master/MY_API_NAME.gitignore
Java 示例:
curl -o .gitignore https://raw.githubusercontent.com/github/gitignore/master/Java.gitignore
Windows
以下是Windows的一些类似的替代方案。
但诚实地设置它看起来似乎比它更值得的麻烦。 如果我有 Windows, 那么我会在我的工程根文件夹中创建一个空文件, 名为 < code>. gitignore , 然后复制并粘贴默认文本, 从 < em> gitignore. io 或 GitHub 。