This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the git category.
Last Updated: 2024-11-21
You run this:
git check-ignore -v fileOrFolderName
In my case I learned that the surprising behavior I was seeing was due to a global config in ~/.gitignore_global
The main modifiers to be aware of are:
/
/
!
target/ #…folder (due to the trailing /) recursively
target #…file OR folder named `target` recursively
/target #…file or folder named target in the _top-most_ directory (due to the leading /)
/target/ #…folder named target in the top-most directory (leading and trailing /)
!target # override the effect of a previous ignore and allow the file named `target`