Git - gitignore file
Table of Contents
Sample gitignore files
A collection of .gitignore templates
https://github.com/github/gitignore
How to force add everything from a folder?
Sometimes, we may want to add everything from a folder ignoring all the other rules
e.g. .mvn directory when using a maven wrapper
To do this, use the force (-f) flag
git -f .mvn
.gitignore everything in a folder except for one file
https://www.reddit.com/r/git/comments/tqqcfu/gitignore_everything_in_a_folder_except_for_one/
node_modules/
Run git add -f node_modules/file to force add the file. Then subsequent changes to the file will be tracked also.
You can always add a file that have a match in a .gitignore, just use the force option and git will track that file like any other tracked file, .gitignore only affects files that are untracked.