Ever run into .gitignore not working or Git ignoring case-sensitive filename changes? This article explains why these issues happen and shows three easy fixes—clearing cache, enabling case tracking, and renaming files properly with Git commands.
Written by: Chia1104 CC BY-NC-SA 4.0
When working on development, I often encountered two common Git issues:
.gitignore, already tracked files couldn’t be ignored..gitignore not taking effectThe reason is that Git caches files that are already tracked. If certain files have been committed before, adding them to .gitignore won’t make any difference. To fix this, you can remove the local cache and commit again.
git rm -r --cached .
git add .
git commit -m "fix: update .gitignore"Here, the command git rm -r --cached . clears all cached files, but you can also specify individual file paths if needed.
By default, Git doesn’t track filename changes that only differ in letter case.
git rm -r --cached .
git add .
git commit -m "fix: update file name"git config --local core.ignorecase falsegit mv -f readme.md README.md