Skip to content

Instantly share code, notes, and snippets.

@k06a
Last active May 14, 2021 03:14
Show Gist options
  • Save k06a/25a0214c98bc19fd6817 to your computer and use it in GitHub Desktop.
Save k06a/25a0214c98bc19fd6817 to your computer and use it in GitHub Desktop.
Git remove some dirs
git ls-tree -r -t -l --full-name HEAD | sort -n -k 4
git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch dir1' HEAD
git update-ref -d refs/original/refs/heads/master
git show-ref refs/original/* --hash | xargs -n 1 git update-ref -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment