Skip to content

Instantly share code, notes, and snippets.

@pamobo0609
Created December 22, 2020 23:26
Show Gist options
  • Save pamobo0609/a8dae4893fb68f6d03c65a23c89cc2b2 to your computer and use it in GitHub Desktop.
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.
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