Skip to content

Commit

Permalink
*: add an shell script to make checkout PR branch easier. (pingcap#4794)
Browse files Browse the repository at this point in the history
When a PR is not trivial, we need to checkout the branch to review the PR, this scripts makes this task easier.
  • Loading branch information
coocood authored and winkyao committed Oct 18, 2017
1 parent 6e63f38 commit 8643b2b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions checkout-pr-branch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# This script is used to checkout a TiDB PR branch in a forked repo.
if test -z $1; then
echo -e "Usage:\n"
echo -e "\tcheckout-pr-branch.sh [github-username]:[pr-branch]\n"
echo -e "The argument can be copied directly from github PR page."
echo -e "The local branch name would be [github-username]/[pr-branch]."
exit 0;
fi

username=$(echo $1 | cut -d':' -f1)
branch=$(echo $1 | cut -d':' -f2)
local_branch=$username/$branch
fork="https://github.com/$username/tidb"
git fetch $fork $branch:$local_branch
git checkout $local_branch

0 comments on commit 8643b2b

Please sign in to comment.