Skip to content

Commit

Permalink
Merge pull request #323 from PSLmodels/git-tools
Browse files Browse the repository at this point in the history
Add same git tools as used in Tax-Calculator repository
  • Loading branch information
martinholmer authored Dec 16, 2024
2 parents c2627fc + cc773be commit 96f7f0a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
19 changes: 19 additions & 0 deletions gitpr
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions gitsync
Original file line number Diff line number Diff line change
@@ -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 <branch-name>

0 comments on commit 96f7f0a

Please sign in to comment.