Skip to content

Commit

Permalink
script for checking out a pr
Browse files Browse the repository at this point in the history
  • Loading branch information
adeebshihadeh committed Dec 27, 2023
1 parent 4df8506 commit 6810c5b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions scripts/checkout-pr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -e

if [ $# -eq 0 ]; then
echo "usage: $0 <pull-request-number>"
exit 1
fi

BASE="https://github.com/commaai/openpilot/pull/"
PR_NUM="$(echo $1 | grep -o -E '[0-9]+')"
BRANCH=tmp-pr${PR_NUM}

git branch -D -f $BRANCH || true
git fetch -u -f origin pull/$PR_NUM/head:$BRANCH
git switch $BRANCH
git reset --hard FETCH_HEAD

0 comments on commit 6810c5b

Please sign in to comment.