Skip to content

Instantly share code, notes, and snippets.

@toddway
Created April 18, 2018 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toddway/0e0ea95161e7d036d4454d374d5ebc2c to your computer and use it in GitHub Desktop.
Save toddway/0e0ea95161e7d036d4454d374d5ebc2c to your computer and use it in GitHub Desktop.
bash command to fetch PR and launch in Android Studio
#!/bin/sh
if [ -z "$1" ]
then
echo must provide a PR number
else
git fetch origin pull/$1/head:pr-$1 # for github
git fetch origin pull-requests/$1/from:pr-$1 # for bitbucket
git checkout pr-$1
studio .
fi
# SETUP
# if you haven't already cloned the repo develop branch locally:
git clone -b develop <repo-url> .
# initialize the Android Studio command line launcher: Tools > Create Command-line Launcher... > OK
# COMMAND
sh ~/pr-to-ide.sh <pr-id> # get the pr-id from the pull request url - usually just an incrementing number
# now use IDE to diff the develop branch, run tests, navigate files, see code inspection, etc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment