Created
May 28, 2019 19:00
-
-
Save joshbooks/68c24fa1bd7f3b264fd20b9684fe785a to your computer and use it in GitHub Desktop.
view your pull requests for the git repo in the current directory assuming you have GITHUB_USERNAME set
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
read -ra gitUrls <<< `git remote -v | awk '{print $2}' | sort -u` | |
if [[ ${#gitUrls[@]} -eq 1 ]] | |
then | |
selection=0 | |
else | |
selections=0 | |
for gitUrl in ${gitUrls[@]} | |
do | |
echo "[$selections] $gitUrl" | |
done | |
echo "which git url would you like to use?" | |
read selection | |
fi | |
selectedUrl=${gitUrls[$selection]} | |
echo "$selectedUrl" | |
if [[ ! -z `echo $selectedUrl | grep '.*@.*:.*\.git'` ]] | |
then | |
repoUrl=`echo $selectedUrl | sed -e 's|.*\@\(.*\):\(.*\).git|\1/\2|'` | |
else | |
repoUrl=`echo $selectedUrl | sed 's/.git$//'` | |
fi | |
echo "https://$selectedUrl/pulls/$GITHUB_USERNAME" | |
open "https://$repoUrl/pulls/$GITHUB_USERNAME" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment