#!/bin/sh branch=master while getopts b: opt; do case $opt in b) branch="$OPTARG";; \?) exit 1;; esac done shift $((OPTIND-1)) if [ -z "$1" ]; then git checkout "$branch" git pull upstream "$branch" git push git checkout fly git merge --no-edit "$branch" git push else for dir; do git -C "$dir" checkout "$branch" git -C "$dir" pull upstream "$branch" git -C "$dir" push git -C "$dir" checkout fly git -C "$dir" merge --no-edit "$branch" git -C "$dir" push done fi