Created
July 30, 2018 14:04
-
-
Save ultim8k/e6ef2354e54cc7d3e1aeb14300fec1fb to your computer and use it in GitHub Desktop.
Get url for pull request to current repo's remote origin
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
function get_pull_request_url () { | |
local GIT_BRANCH_NAME=$(git symbolic-ref --short HEAD); | |
local GIT_REMOTE_URL=$(git config --get remote.origin.url); | |
# [email protected]:USER_NAME/REPO_NAME.git | |
local GIT_FULL_REMOTE_NAME=$(echo $GIT_REMOTE_URL | sed -e 's/[email protected]://' -e 's/\.git//'); | |
# https://github.com/ORG_NAME/REPO_NAME/compare/GIT_BRANCH_NAME?expand=1 | |
echo "https://github.com/${GIT_FULL_REMOTE_NAME}/compare/${GIT_BRANCH_NAME}?expand=1" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment