Skip to content

Instantly share code, notes, and snippets.

@anthager
Last active September 3, 2019 21:33
Show Gist options
  • Select an option

  • Save anthager/ab94517b4680363d88fbebe8f0140c93 to your computer and use it in GitHub Desktop.

Select an option

Save anthager/ab94517b4680363d88fbebe8f0140c93 to your computer and use it in GitHub Desktop.
Bash function for opening the url of a new pr of the current branch in the current repo, perfect for .(zsh|bash)rc
gcpr() {
if ! git remote show origin -n &>/dev/null; then
echo Not a repo m8
return 1
fi
open "https://github.com/$(git remote show origin -n | grep "Fetch URL:" | cut -d : -f 3 | cut -d . -f 1)/pull/new/$(git rev-parse --abbrev-ref HEAD)"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment