Reputation: 2909
I have a repository with lots of bash scripts that I want to ignore. The problem is that the bash scripts don't have a .sh
extension, but instead have #!/bin/bash
at the start to signify that they are bash scripts. As a result, they cannot be identified by their file name.
I have tried putting *.sh
in my .gitignore (and resetting the cache), but the bash scripts are still tracked.
Is there any way I can ignore these bash scripts in my .gitignore?
Upvotes: 1
Views: 447
Reputation: 6762
# Run in repo's root directory
grep -rl '^#!/bin/bash' . >> .gitignore
This will list all the files with bash shebang and append it to .gitignore
Upvotes: 3