Skip to content

Instantly share code, notes, and snippets.

https://stackoverflow.com/questions/17901588/new-repo-with-copied-history-of-only-currently-tracked-files
git remote | while read -r line; do (git remote rm "$line"); done
git tag | xargs git tag -d
git branch | grep -v \* | xargs git branch -D
git stash clear
git config --local -l | grep submodule | sed -e 's/^\(submodule\.[^.]*\)\(.*\)/\1/g' | while read -r line; do (git config --local --remove-section "$line"); done
rm -rf .git/modules/
git ls-files | sed -e 's/^/"/g' -e 's/$/"/g' > keep-these.txt