gitignore.pro
.gitignore
fileSelect your tech stack, and we'll generate an annotated file with best practices.
# Select templates from the left to generate your .gitignore file
This is the most common issue. It happens because Git is already tracking the files you want to ignore. To fix this, you need to clear Git's cache with the following commands:
git rm -r --cached .
git add .
git commit -m "fix: Untrack files"
Git doesn't track empty folders. To force it to, place an empty file named .gitkeep
inside the folder you want to keep. Then, add this to your .gitignore
file to ignore everything else in that folder:
# Ignore all files in the 'logs' folder
logs/*
# But DO NOT ignore the .gitkeep file
!logs/.gitkeep