Created
March 9, 2021 13:17
-
-
Save kidmose/4c5ef87a19323957ef49ac67a281a1f7 to your computer and use it in GitHub Desktop.
Take a local cloned git repo, created it on github, and make sure all branches from the old origin is now on github
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
#!/usr/bin/env bash | |
git remote rename origin old | |
gh repo create $(basename $(pwd)) --private --confirm | |
git checkout master | |
git push -u origin master | |
for branch in $(git for-each-ref --format='%(refname:lstrip=-1)' refs/remotes/old \ | |
| grep -v '^HEAD$' | grep -v '^master$' ); do | |
git checkout --track old/$branch | |
git push -u origin $branch | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment