Note: I have removed this question from duplicate because while using !run.sh works for me, i am looking to allow any file in ansible/files as well.(Any file that i might add in the future.) The other solutions for the same that i found did not work for me.
I want to exclude all .sh
files from my repository, and for that i've used *.sh
but then i want to include any file in ansible/files
Currently, my .gitignore
file looks like this:
# Ignore python environment
venv/
# Ignore .pyc files
*.pyc
# Ignore .log Files
*.log
# Ignore any __pycache__
__pycache__/
# Ignore .sh files
*.sh
# Allow any `.sh` file(s) in ansible/files folder
!/ansible/files/*.sh
# Allow any file(s) in ansible/files folder
!/ansible/files/*
But this isn't working, ansible/files/run.sh
is a file that exists but doesn't get tracked.
Question: Why is .gitignore
ignoring !/ansible/files/*.sh
& !/ansible/files/*
; how to allow any file in that folder to be tracked?
Note: I have removed this question from duplicate because while using !run.sh works for me, i am looking to allow any file in ansible/files
as well.(Any file that i might add in the future.)
The other solutions for the same that i found did not work for me.