Last active
February 13, 2018 09:38
-
-
Save Flydiverny/974e7247e80b2ca782a9311926f2fe13 to your computer and use it in GitHub Desktop.
git link
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
#!/bin/bash | |
REMOTE_URL=$(git remote get-url origin) | |
REST=${REMOTE_URL##git@github.com:} | |
REPO=${REST%%.git} | |
REF=$1 | |
REF=${REF:='HEAD'} | |
HASH=$(git rev-parse "$REF") | |
echo -n "https://github.com/$REPO/commit/$HASH" | pbcopy | |
echo "Commit link copied to clipboard" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment