Last active
October 19, 2018 19:21
-
-
Save Harwood/1f373f5a97e76ebc037f5fadc11d7857 to your computer and use it in GitHub Desktop.
This file contains 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
#! /usr/bin/env bash | |
set -e | |
base_url=`git config --get remote.origin.url` | |
current_branch=`git rev-parse --abbrev-ref HEAD` | |
current_sha1=`git show-ref --heads --hash ${current_branch}` | |
if [ ${base_url} == *'http'* ] | |
then | |
base_url=(${base_url//["//"]/ }) | |
fi | |
base_url=(${base_url//[:@]/ }) | |
base_url=${base_url%.git} | |
echo https://${base_url[1]}/commit/${current_sha1} | tr -d '\r' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should convert this to be a git alias