Skip to content

Instantly share code, notes, and snippets.

@chebyte
Created February 6, 2012 16:08
Show Gist options
  • Save chebyte/1752937 to your computer and use it in GitHub Desktop.
Save chebyte/1752937 to your computer and use it in GitHub Desktop.
delete file from commit in git
$ git verify-pack -v .git/objects/pack/pack-4d5c6dc98db773d7df9c01d5d645ff954bfa2e49.idx | sort -k 3 -n | tail -3
61cad2a1f34f09b77e127e0a7f0748917d7d5c78 blob 557568 555456 492171
d655b4e185c0e2853bf946121cb96a55bc95bd65 blob 2436608 2435171 143444913
3541fcf92467242889f0b5a574405650dc461341 blob 140146688 140186258 1644162
$ git rev-list --objects --all | grep 3541fcf92
3541fcf92467242889f0b5a574405650dc461341 pkg/youtube_it-1.2.7.gem
$ git log --pretty=oneline --all -- pkg/youtube_it-1.2.7.gem
3e550a28267f0ba40158148f250cdec2a0a8daa4 remove older gems
a763e09e9ae6c22fc86dad2d66aaa9f088885ac1 remove older gems
$ git filter-branch --index-filter 'git rm --ignore-unmatch pkg/youtube_it-1.2.7.gem' --tag-name-filter cat -- --all
$ rm -Rf .git/refs/original
$ git gc --aggressive --prune=now
$ git push origin master --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment