Created
April 29, 2020 16:57
-
-
Save jdeeburke/32a92fbd68a05b6d59d9748ea07f9230 to your computer and use it in GitHub Desktop.
GitHub Helper Shell Commands
This file contains hidden or 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
# Only tried this on mac, would probably need some adaptation for Linux folks :) | |
# | |
# Add this to your .bashrc or .zshrc file and reload terminal for it to take effect | |
# Output GitHub PR URL for the current git repo | |
ghpr() { | |
repo=$(git remote -v | sed -n 's/^origin.*git@github\.com:\(.*\)\.git.*fetch.*/\1/p') | |
branch=$(git branch --show-current) | |
echo "https://github.com/$repo/compare/$branch?expand=1" | |
} | |
# Open GitHub PR URL in Browser | |
ghpro() { | |
url="$(ghpr)" | |
open $url | |
} | |
# Copy GitHub PR URL to clipboard | |
alias ghprc="ghpr | pbcopy" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment