Last active
May 15, 2019 05:35
-
-
Save michrome/6008805 to your computer and use it in GitHub Desktop.
Add these to your .profile to allow you to pull and push all your branches with a remote Git server.
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
# Usage: | |
# `git-pull-all` to pull all your local branches from origin | |
# `git-pull-all remote` to pull all your local branches from a named remote | |
function git-pull-all() { | |
START=$(git symbolic-ref --short -q HEAD); | |
for branch in $(git branch | sed 's/^.//'); do | |
git checkout $branch; | |
git pull ${1:-origin} $branch || break; | |
done; | |
git checkout $START; | |
}; | |
function git-push-all() { | |
git push --all ${1:-origin}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment