Skip to content

Instantly share code, notes, and snippets.

@pitr
Last active August 29, 2015 14:00
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 pitr/8242ac5253a72ddf3838 to your computer and use it in GitHub Desktop.
Save pitr/8242ac5253a72ddf3838 to your computer and use it in GitHub Desktop.
gbr - Open PR with current branch in bitbucket
gbr() {
originurl=$(git config --get remote.origin.url | tr '[:upper:]' '[:lower:]')
originurl=${originurl/git\@bitbucket\.org\:/https://bitbucket.org/}
originurl=${originurl/\git:/https:}
originurl=${originurl/\.git/}
path=$(git config --get remote.origin.url | tr '[:upper:]' '[:lower:]' | sed -e 's/git@bitbucket.org://')
branchName=$(git rev-parse --abbrev-ref HEAD)
giturl=$originurl"/pull-request/new?source="$path"::"$branchName
open $giturl
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment