Skip to content

Instantly share code, notes, and snippets.

@mowtschan
Created March 7, 2022 11:48
Show Gist options
  • Save mowtschan/245f20a588d5dfa1f83b60449e7e5e74 to your computer and use it in GitHub Desktop.
Save mowtschan/245f20a588d5dfa1f83b60449e7e5e74 to your computer and use it in GitHub Desktop.
Open browser for Pull Request in azure devops
#!/usr/bin/env bash
set -e
BRANCH=$(git rev-parse --abbrev-ref HEAD)
TARGET_BRANCH=main
REMOTE=$(git remote get-url origin)
# assume the repo uses SSH
REMOTE=${REMOTE#"git@ssh.dev.azure.com:v3/"}
arr=(${REMOTE//// })
REMOTE="${arr[0]}/${arr[1]}/_git/${arr[2]}"
URL="https://dev.azure.com/$REMOTE/pullrequestcreate?sourceRef=$BRANCH&targetRef=$TARGET_BRANCH"
open "$URL"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment