.gitignoreA special file that tells Git which files to ignore. Common patterns include *.log for log files, .env for environment variables, and node_modules/ for dependencies. Add .gitignore to your repo to keep generated files and secrets out of version control.
git rm --cachedRemoves a file from Git's tracking without deleting it from your disk. Useful when you accidentally committed a file that should have been in .gitignore (e.g., .env files, API keys, build artifacts). After running git rm --cached, the file stays on disk but the next commit will remove it from Git's history.
Check the repository status
Run git status to see the current state. Notice that secret.env is tracked (it was committed), while debug.log and .env are untracked. These generated files should NOT be in version control.