Created
December 22, 2020 23:26
-
-
Save pamobo0609/a8dae4893fb68f6d03c65a23c89cc2b2 to your computer and use it in GitHub Desktop.
This small script allows you to checkout a pull request branch so you can compile the code someone wants to merge before merging.
This file contains hidden or 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
echo "--- Welcome to the Pull Request super tool. ---\n" | |
read -p "Please enter the Pull Request id: " id | |
re='^[0-9]+$' | |
if ! [[ $id =~ $re ]] ; then | |
echo "Error: Pull Request id must be numeric" >&2; exit 1 | |
fi | |
read -p "Please enter the branch name to checkout on local: " branchName | |
if [ -z "$branchName" ]; then | |
echo "Error: The branch name must not be empty." >&2; exit 1 | |
fi | |
git fetch origin pull/$id/head:$branchName && git checkout -b review/$id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment