Skip to content

Instantly share code, notes, and snippets.

@ivanacostarubio
Created October 4, 2011 20:41
Show Gist options
  • Select an option

  • Save ivanacostarubio/1262736 to your computer and use it in GitHub Desktop.

Select an option

Save ivanacostarubio/1262736 to your computer and use it in GitHub Desktop.
git2all.sh
# /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