Skip to content

Instantly share code, notes, and snippets.

@gjhead
Last active June 26, 2020 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gjhead/87a71c6502f65b4568a586e39336993f to your computer and use it in GitHub Desktop.
Save gjhead/87a71c6502f65b4568a586e39336993f to your computer and use it in GitHub Desktop.
Restablish .gitignore
For when you make a change to .gitignore and the stupid thing still keeps old files in there.
To untrack a single file that has already been added/initialized to your repository, i.e., stop tracking the file but not delete it from your system use: git rm --cached filename
To untrack every file that is now in your .gitignore:
First commit any outstanding code changes, and then, run this command:
git rm -r --cached .
This removes any changed files from the index(staging area), then just run:
git add .
Commit it:
git commit -m "restablish .gitignore"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment