I use a results
directory for storing data generated by my code. This data I do not wish to keep in the repo, so I ignore all files with the extensions the data uses (.csv, .txt).
Unfortunately, git does not track empty directories. A solution, as presented here, is to stick a .gitignore
file in the directory. This works well. However....
I often want to clean out the directory to not confuse old results with new. Often, I will rename the old one and make a new one with the old name. (e.g., now I will have the directorys results_old
and an empty results
).
The problem is that now the .gitignore file is missing from the results
directory and I need to manually add it back.
Is there any utility that can be used to 'replace' the .gitignore or enforce that it is 'recreated' in that directory?
Top level .gitignore
contents:
*.csv
*.txt
*.text
__pycache__