Skip to content

Instantly share code, notes, and snippets.

@saml
Created May 15, 2020 17:42
Show Gist options
  • Save saml/c56f5ba5c28a408febcebf54d5dcb94c to your computer and use it in GitHub Desktop.
Save saml/c56f5ba5c28a408febcebf54d5dcb94c to your computer and use it in GitHub Desktop.
#!/bin/bash
REPOS=(foo bar)
git_up() {
if (( $# > 0 ))
then
repos=$@
else
repos=${REPOS[@]}
fi
for repo in "${repos[@]}"
do
cd "$repo"
git pull --rebase
done
}
cmd="$1"
shift 1
case "$cmd"
in
git_up)
git_up "$@"
;;
*)
echo "Usage: $0 git_up [projects...]"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment