DEV Community

Discussion on: I use the GitHub Desktop app for one thing. Am I doing this wrong?

Collapse
 
andy profile image
Andy Zhao (he/him) • Edited

To review PRs, I use what @maestromac showed me, which is running the git command:

git fetch upstream pull/pull-request-issue/head:name-of-branch-locally

So for example:

git fetch upstream pull/1579/head:1579-share-dropdown

I can never remember the full command though so I made it into a bash function:

rvpr() {
  # check if second argument was given
  if [ -z "$2" ]; then
    git fetch upstream pull/$1/head:$1-pull-request
  else
    git fetch upstream pull/$1/head:$1-$2
  fi
}

# to be used like:
rvpr 1579 share-dropdown
#=> an alias for git fetch upstream pull/1579/head:1579-share-dropdown