Skip to content

Instantly share code, notes, and snippets.

@AlainODea
Created September 12, 2012 02:26
Show Gist options
  • Save AlainODea/3703839 to your computer and use it in GitHub Desktop.
Save AlainODea/3703839 to your computer and use it in GitHub Desktop.
Restore Git branches after backup restore of Git Server
#!/usr/bin/env bash
function checkout_and_push {
git checkout $1 && git push origin $1
}
git branch -r | cut -c 10- | grep -ve '^HEAD' | while read i; do checkout_and_push $i; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment