-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #323 from PSLmodels/git-tools
Add same git tools as used in Tax-Calculator repository
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |