Created
October 4, 2011 20:41
-
-
Save ivanacostarubio/1262736 to your computer and use it in GitHub Desktop.
git2all.sh
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/sh | |
| # | |
| # It applies a git command to the configured remotes | |
| # | |
| # Usage: git2all.sh command branch | |
| # | |
| # comand - can be any git command. For example: pull and push. | |
| # branch - any git branch you want to apply the command to. | |
| # | |
| remotes=$(git remote) | |
| function missing_parameters(){ | |
| echo "Usage: git2all.sh command branch" | |
| exit 77 | |
| } | |
| if [ -z $1 ]; then | |
| missing_parameters | |
| fi | |
| if [ -z $2 ]; then | |
| missing_parameters | |
| fi | |
| for REMOTE in ${remotes} ; do | |
| echo "Working with: "${REMOTE} | |
| git $1 ${REMOTE} $2 | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment