git-cheatsheet
git-cheatsheet copied to clipboard
Making git "forget" about all files that are already tracked but are in .gitignored
http://stackoverflow.com/a/19095988/709769
Remove all files from repo:
git rm -r --cached .
Re-add all files:
git add .
then
git commit -am "Remove ignored files"
@madc perfect I would phrase it more like this question though.
Applying .gitignore to committed files
- Edit .gitignore to match the file you want to ignore
- git rm --cached /path/to/file
There is a difference between the two posts. Mine takes care of removing all files that are listed in the .gitignore. Sticking with the answer referenced by you, you still have to remove all files separately (i.e. node_modules/* and .idea/*)
I disagree! Dot (.) is a path like anyone else, just means the current directory.
That's true, but than your answer is only showing half the workflow.
Edit: Just realized, that the topic did not really said, what i wanted to do. Renamed it.
Hmm, you're right, that's a better flow.
I like my title better though... (I have to win one at least)