diff options
author | Xiao Pan <xyz@flylightning.xyz> | 2024-07-31 00:03:41 -0700 |
---|---|---|
committer | Xiao Pan <xyz@flylightning.xyz> | 2024-07-31 00:03:41 -0700 |
commit | b6bbb3216efdb8ca9d7543a0483e45322af85e2c (patch) | |
tree | c396e1e986269f872b24e25482c77f1fe71fbad5 | |
parent | 8426b555f5756bca6e0bfb48969856a9967c7e08 (diff) |
gitpu add branch argument
-rwxr-xr-x | sh/gitpu | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -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 |