Last active
March 26, 2018 20:39
-
-
Save dexterous/1245332 to your computer and use it in GitHub Desktop.
Migrating a repo to GitHub
This file contains hidden or 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
cd path/to/git/repo | |
git remote add github [email protected]:${user_or_org}/${repo}.git | |
git remote rename origin old | |
for b in `git branch -r --no-color | cut -b3- | grep --color=none '^old/' | grep -v '/HEAD ' | cut -d '/' -f2` | |
do | |
git push github old/$b:refs/heads/$b | |
done | |
git push --tags github | |
git remote rename github origin |
This file contains hidden or 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
git remote rename origin old | |
git remote add github [email protected]:${user_or_org}/${repo}.git | |
for b in `git branch | cut -b3-` | |
do | |
git branch --set-upstream $b github/$b | |
done | |
git remote rename github origin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment