Created
November 23, 2011 17:06
-
-
Save groupsky/1389227 to your computer and use it in GitHub Desktop.
Backup git repo to another repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Pushesh all branch heads from origin remote to backup repo | |
# prerequisites: | |
# 1. git clone <from the origin> | |
# 2. git remote add backup <backup repo> | |
git branch -a | grep remotes/origin | cut '-d/' -f3 | grep -v HEAD | while read i; do git push -u backup remotes/origin/$i:refs/heads/$i; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment