Gitignore 忽略 bash 没有文件扩展名的脚本
Gitignore ignore bash scripts without file extension
我有一个存储库,其中包含许多我想忽略的 bash 脚本。问题是 bash 脚本没有 .sh
扩展名,而是在开头有 #!/bin/bash
以表示它们是 bash 脚本。因此,无法通过文件名识别它们。
我已经尝试将 *.sh
放入我的 .gitignore(并重置缓存),但 bash 脚本仍然被跟踪。
有什么方法可以在我的 .gitignore 中忽略这些 bash 脚本?
# Run in repo's root directory
grep -rl '^#!/bin/bash' . >> .gitignore
这将列出所有带有 bash shebang 的文件并将其附加到 .gitignore
我有一个存储库,其中包含许多我想忽略的 bash 脚本。问题是 bash 脚本没有 .sh
扩展名,而是在开头有 #!/bin/bash
以表示它们是 bash 脚本。因此,无法通过文件名识别它们。
我已经尝试将 *.sh
放入我的 .gitignore(并重置缓存),但 bash 脚本仍然被跟踪。
有什么方法可以在我的 .gitignore 中忽略这些 bash 脚本?
# Run in repo's root directory
grep -rl '^#!/bin/bash' . >> .gitignore
这将列出所有带有 bash shebang 的文件并将其附加到 .gitignore