Skip to content

Instantly share code, notes, and snippets.

@Harwood
Last active October 19, 2018 19:21
Show Gist options
  • Save Harwood/1f373f5a97e76ebc037f5fadc11d7857 to your computer and use it in GitHub Desktop.
Save Harwood/1f373f5a97e76ebc037f5fadc11d7857 to your computer and use it in GitHub Desktop.
#! /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'
@Harwood
Copy link
Author

Harwood commented Oct 19, 2018

Should convert this to be a git alias

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment