Save Unrelated Files in Git Projects Without Modifying Gitignore

Jun 1, 2022

01164-a-treasure-coffer–extremely-detailed–in-the-style-of-cyberpunk-(-steampunk-)–day-light–realistic

Sometimes you have files related to the project, but you don’t want to commit them to the Git repo itself.

Project logo of various sizes, sample files to upload to test different behaviors, screen recordings of bugs, etc.

But you still want to have them in your repo, since they are project-related.

Modifying .gitignore is an option. Since each person could have their own personal files in there, adding a line local to .gitignore to skip tracking the local folder, is an idea. The only minor disadvantage is that people might think that the local folder is generated by the code, when it’s not.

Another idea is to ignore that file, but from the .git/info/exclude file. This one will be local to your repo only. It can achieve the same functionality as the .gitignore, but it’s local.

As a plus, instead of calling the folder local, you could call it $YOURNAME, so that you know for sure that folder is not being tracked.


Do you have any feedback/comments? Hit me up at maxiredigonda@gmail.com