Git Untrack Already Tracked Files

       

To remove files that are currently being tracked by git, you have to remove them from the "cache". Note, doing this will NOT delete the file on your local machine. It will still be there but not be tracked.

 git rm -r --cached supersecretpasswords.txt 
You then need to add the file to the .gitignore file in the root of the project so that it isn't tracked again on your next commit.

vim .gitignore supersecretpasswords.txt

.gitignore files are tracked so remember to check in these changes.

git commit -am'my super secret passwords are safe!'

If you want to completely delete the file, on your local machine and from git


git rm supersecretpasswords.txt
If you're working with a directory remember to add the -r flag for recursive removal!

Tagged w/ #development #git #gitignore #productivity #rm #source control #workflowgit

Apps I've Built

PhotoLocationChanger
Easily change the location on your photos and videos
Click here for more info about the app
PhotoDateChanger
Easily change the dates and times on your photos and videos
Click here for more info about the app
VocabReminder
English dictionary with notifications so you won't forget what you're studying!
Click here for more info about the app
VocabQuiz
The app that quizzes and scores you on your vocabulary!
Click here for more info about the app