From 60319eff83b21e61d7424f9802d291d0bc8fa843 Mon Sep 17 00:00:00 2001 From: "martin.holmer@gmail.com" Date: Mon, 16 Dec 2024 14:28:12 -0500 Subject: [PATCH 1/2] Add same git tools as used in Tax-Calculator repository --- gitpr | 19 +++++++++++++++++++ gitsync | 15 +++++++++++++++ 2 files changed, 34 insertions(+) create mode 100755 gitpr create mode 100755 gitsync diff --git a/gitpr b/gitpr new file mode 100755 index 00000000..b726017f --- /dev/null +++ b/gitpr @@ -0,0 +1,19 @@ +#!/bin/zsh +# stop if not on master branch of local git repo +git branch | awk '$1~/\*/{if($2~/master/){exit 0}else{exit 1}}' +if [[ $? -ne 0 ]] ; then + echo "STOP: not on master branch of local git repo" + exit 1 +fi +# check manditory command-line argument, which is the pull request number +if [[ "$#" -ne 1 ]]; then + echo "ERROR: must specify exactly one command-line argument," + echo " the pull request number, NUM" + exit 1 +fi +NUM=$1 +# create local branch containing upstream pull request with NUM +git fetch upstream pull/$NUM/head:pr-$NUM +git checkout pr-$NUM +git status +exit 0 diff --git a/gitsync b/gitsync new file mode 100755 index 00000000..6a4a12f5 --- /dev/null +++ b/gitsync @@ -0,0 +1,15 @@ +#!/bin/bash +# stop if not on master branch of local git repo +git branch | awk '$1~/\*/{if($2~/master/){exit 0}else{exit 1}}' +if [ $? -ne 0 ]; then + echo "STOP: not on master branch of local git repo" + exit 1 +fi +# synchronize local git repo with central GitHub repo +git fetch upstream +git merge upstream/master +#git push origin master +exit 0 + +# NOTE: to push branch to PR in GitHub repo, do this: +# git push upsteam From cc773be71d370e873242de7af8efda55532f6098 Mon Sep 17 00:00:00 2001 From: "martin.holmer@gmail.com" Date: Mon, 16 Dec 2024 14:48:33 -0500 Subject: [PATCH 2/2] Update gitsync --- gitsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitsync b/gitsync index 6a4a12f5..79a53b0b 100755 --- a/gitsync +++ b/gitsync @@ -8,7 +8,7 @@ fi # synchronize local git repo with central GitHub repo git fetch upstream git merge upstream/master -#git push origin master +git push origin master exit 0 # NOTE: to push branch to PR in GitHub repo, do this: