Suppose you’re working on a project and want to add a custom src/Controller/Debug
folder containing files you want locally but not in Git. You also don’t want to have to edit the .gitignore
file at the project root to add an entry for the src/Controller/Debug
folder.
Here’s how to do that:
You can create a .git/info/exclude
file and add an entry for src/Controller/Debug
there.
vim .git/info/exclude
Then add whatever files/folders you want to ignore:
/src/Controller/Debug
Now, you can add whatever you want inside src/Controller/Debug
and it will all be local to your machine. The files won’t be tracked by Git and you don’t need to edit the root .gitignore
file.