Last active
March 2, 2016 19:57
-
-
Save Emuentes/65a5867c1e0898a359dc to your computer and use it in GitHub Desktop.
Push all local branches to upstream origin -- handy when migrating to a new git host
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
# handy when migrating your local branches to a new git host | |
# git branch prints out each local branch on it's own line | |
# the grep command excludes the lines that end with master, develop, or HEAD | |
# it also excludes the currently checked out branch, which begins with an asterisk | |
# for example: | |
# if your git branch command returns the following: | |
# *develop | |
# master | |
# feature/new-button | |
# hotfix/update-link-href | |
# release/my-app-1.0.0 | |
# the code below will run the following commands in this order: | |
# git push -u origin feature/new-button | |
# git push -u origin hotfix/update-link-href | |
# git push -u origin release/my-app-1.0.0 | |
git branch | grep -v -E '(\*|master$|develop$|HEAD$)' | xargs -n 1 git push -u origin | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment