Easily build a great vocabulary without studying! Now on the App Store!
Click here for more info about the app
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.
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.
git rm -r --cached supersecretpasswords.txt
.gitignore files are tracked so remember to check in these changes.
vim .gitignore supersecretpasswords.txt
git commit -am'my super secret passwords are safe!'
If you want to completely delete the file, on your local machine and from git
If you're working with a directory remember to add the -r flag for recursive removal!
git rm supersecretpasswords.txt