Create a .gitignore
file in your root directory
Must specify filename and extension
example.txt
!example.txt
*.txt
example*
examples/
You can apply the same techniques for multiple files inside the root directory
examples/example.txt
When first ignoring the whole folder, you must have a star at the end.
The star means you are ignoring the files in the folder, while not having a star means that you are ignoring the whole folder
examples/*
!examples/example.txt
This ignores all files named example.txt in every folder. You can use the same techniques for ignoring specific names or extensions with this syntax as well.
**/example.txt
Must include a slash in the beginning
/example.txt
This ignores files named Example.txt
and example.txt
. You can match against as many characters as you like at once.
[Ee]xample.txt