Why is a file still tracked by git after I added it to .gitignore? #45
Answered
by
Kevinchamplin
Kevinchamplin
asked this question in
Q&A
-
|
Why is a file still tracked by git after I added it to .gitignore? |
Beta Was this translation helpful? Give feedback.
Answered by
Kevinchamplin
Jun 13, 2026
Replies: 1 comment
-
|
.gitignore only prevents untracked files from being added — it has no effect on files git is already tracking. Stop tracking it without deleting it locally: |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Kevinchamplin
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.gitignore only prevents untracked files from being added — it has no effect on files git is already tracking. Stop tracking it without deleting it locally:
git rm --cached path/to/file, then commit. For a whole tree,git rm -r --cached .followed bygit add .re-applies the ignore rules.