How do I configure git to ignore some files locally?

From the relevant Git documentation: Patterns which are specific to a particular repository but which do not need to be shared with other related repositories (e.g., auxiliary files that live inside the repository but are specific to one user’s workflow) should go into the $GIT_DIR/info/exclude file. The .git/info/exclude file has the same format as any … Read more

.gitignore exclude folder but include specific subfolder

If you exclude application/, then everything under it will always be excluded (even if some later negative exclusion pattern (“unignore”) might match something under application/). To do what you want, you have to “unignore” every parent directory of anything that you want to “unignore”. Usually you end up writing rules for this situation in pairs: … Read more

Make .gitignore ignore everything except a few files

An optional prefix ! which negates the pattern; any matching file excluded by a previous pattern will become included again. If a negated pattern matches, this will override lower precedence patterns sources. # Ignore everything * # But not these files… !.gitignore !script.pl !template.latex # etc… # …even if they are in subdirectories !*/ # … Read more

Ignore files that have already been committed to a Git repository [duplicate]

To untrack a single file that has already been added/initialized to your repository, i.e., stop tracking the file but not delete it from your system use: git rm –cached filename To untrack every file that is now in your .gitignore: First commit any outstanding code changes, and then, run this command: git rm -r –cached … Read more