Last active
February 28, 2020 13:44
-
-
Save sbatial/9a2d24bbf6e804a3cd2de6e9fbec736d to your computer and use it in GitHub Desktop.
Push all branches in the current 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
#!/bin/bash | |
while getopts r: option | |
do | |
case "${option}" | |
in | |
r) REPOSITORY=${OPTARG};; | |
esac | |
done | |
git remote add origin https://github.com/$REPOSITORY | |
for branch in $(git for-each-ref --format='%(refname:short)' refs/heads/) | |
do | |
git switch $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