From b6bbb3216efdb8ca9d7543a0483e45322af85e2c Mon Sep 17 00:00:00 2001 From: Xiao Pan Date: Wed, 31 Jul 2024 00:03:41 -0700 Subject: gitpu add branch argument --- sh/gitpu | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'sh/gitpu') diff --git a/sh/gitpu b/sh/gitpu index 5453fae..d483add 100755 --- a/sh/gitpu +++ b/sh/gitpu @@ -1,19 +1,28 @@ #!/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 master - git pull upstream master + git checkout "$branch" + git pull upstream "$branch" git push git checkout fly - git merge --no-edit master + git merge --no-edit "$branch" git push else for dir; do - git -C "$dir" checkout master - git -C "$dir" pull upstream master + 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 master + git -C "$dir" merge --no-edit "$branch" git -C "$dir" push done fi -- cgit v1.2.3-70-g09d2