Ignore one folder locally without changing project’s or global .gitignore

I like to keep scrapbook code snippets in the project folder structure, they are connected to the project and keeping them in the home documents or somewhere else would require me to include this folder in the IDE project files.

These scrapbook code snippets are for me alone, no need to version them they are just a dirty notes that would not be missed if deleted by mistake, but useful and wort to be saved in the project itself for the for some amount of time.

I use .tmp folder for that, but I don’t want to put mention this folder anywhere not in the project .gitignore nor in any global .gitignore — I don’t want to pollute them with something only I would benefit from.

├── .tmp
├── docs
├── src
├── tests
├── README.md
├── setup.cfg

The easiest way to achieve that is to put .gitignore file in the folder itself with * in it:

# This folder ignored entirely

And if you would want to make sure that this empty folder exists in repository put this instead:

# This folder is used by builds. It's contents should never get into the repo
# but the folder is not not always created by tools, thus it should exists.


Leave a Reply

Back to Top