Skip to content

Instantly share code, notes, and snippets.

@crater2150
Created August 13, 2014 10:40
Show Gist options
  • Save crater2150/a95a64bbc08d67413d47 to your computer and use it in GitHub Desktop.
Save crater2150/a95a64bbc08d67413d47 to your computer and use it in GitHub Desktop.
Make a copy of a git repo with unpacked refs and objects
mkdir new_repo && cd new_repo
git init
git unpack-objects < /path/to/old/repo/.git/objects/pack/*.pack
git unpack-refs
[alias]
unpack-refs = "!bash -c 'IFS=$''\\n''; for f in $(git show-ref --heads); do /bin/echo ''Writing '' $(echo $f | cut -c42-); echo $(echo $f | cut -c1-40) > \"${GIT_DIR:-.git}/$(echo $f | cut -c42-)\"; done'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment