Created
June 20, 2018 13:20
-
-
Save Ickerday/4e8bee4ab9ca73a49b7980197303f035 to your computer and use it in GitHub Desktop.
Unfuck git (remove ignored but tracked files)
This file contains 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/sh | |
if ! [ -d .git ] | |
then | |
echo >&2 Not in top level of a git repo | |
exit 1 | |
fi | |
# Remove _every_ file from tracking | |
git ls-files | xargs git rm --cached | |
# re-add everything (now gitignored files will be ignored) | |
git add . | |
echo Check your changes | |
git status | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment