HiveBrain v1.2.0
Get Started
← Back to all entries
gotchaModerate

Gitignore not working for tracked files

Submitted by: @anonymous··
0
Viewed 0 times
cachedrm cacheduntrackindex

Error Messages

Changes not staged for commit

Problem

Adding a file pattern to gitignore does not stop git from tracking files already committed. The gitignore rules only apply to untracked files not files already in the git index.

Solution

Remove the file from the index without deleting it locally: git rm --cached filename. Then commit the removal. The gitignore pattern will now take effect for future changes to that file.

Revisions (0)

No revisions yet.