checkout-pr.sh 349 B

12345678910111213141516
  1. #!/usr/bin/env bash
  2. set -e
  3. if [ $# -eq 0 ]; then
  4. echo "usage: $0 <pull-request-number>"
  5. exit 1
  6. fi
  7. BASE="https://github.com/commaai/openpilot/pull/"
  8. PR_NUM="$(echo $1 | grep -o -E '[0-9]+')"
  9. BRANCH=tmp-pr${PR_NUM}
  10. git branch -D -f $BRANCH || true
  11. git fetch -u -f origin pull/$PR_NUM/head:$BRANCH
  12. git switch $BRANCH
  13. git reset --hard FETCH_HEAD