Skip to content

Instantly share code, notes, and snippets.

@bjtitus
Last active February 14, 2020 21:33
Show Gist options
  • Save bjtitus/c6747f26ecfcc17ad64e2c154c786ed9 to your computer and use it in GitHub Desktop.
Save bjtitus/c6747f26ecfcc17ad64e2c154c786ed9 to your computer and use it in GitHub Desktop.
Open current branch in Github
# For Bash or ZSH
function gh-pr() {
branch=`git rev-parse --abbrev-ref HEAD`
prNum=`gh pr list | grep '$branch' | grep -o '[0-9]\+' | head -1`
gh pr view $prNum
}
function gh-pr --description 'Opens the current branch on Github.'
set branch (git rev-parse --abbrev-ref HEAD)
set prNum (gh pr list | grep '$branch' | grep -o '[0-9]\+' | head -1)
gh pr view $prNum
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment