Untracking stuff in git

Published at

#git

This TIL is more than a year old. Some details may have changed.

Accidental tracking and commits to git happens. Here's how to remove the stuff again.

Remember to add the stuff to .gitignore

BASH
$ git rm -r --cached <file-or-directory-name>
$ git commit -m "Yes I did not mean to include these..."
$ git push origin main