Last active
December 23, 2015 01:59
-
-
Save jahanson/6563942 to your computer and use it in GitHub Desktop.
Linux git command that removes files in your repo that apply to the .gitignore but doesn't delete them. Ex. You added some rules after a while and need them to be applied immediately.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
(GIT_INDEX_FILE=some-non-existent-file \ | |
git ls-files --exclude-standard --others --directory --ignored -z) | | |
xargs -0 git rm --cached -r --ignore-unmatch -- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From stack overflow post http://stackoverflow.com/a/3262033