Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

push: only copy GitHub compare url if remote is on GitHub

  • Loading branch information...
commit fc39ebd15f62516e29d767ba6efe7dc1b2459bd0 1 parent 8c5b721
@jamiew authored
Showing with 9 additions and 8 deletions.
  1. +9 −8 push
View
17 push
@@ -31,15 +31,16 @@ fi
echo $push
# Parse output into sexy GitHub compare URL!
-# TODO only do this if the remote is actually on GitHub :)
remote_url=$(git remote show $remote -n | grep Push | awk '{ print $3 }')
-repo_name=$(echo $remote_url | sed 's/.*\:\(.*\)\.git/\1/')
-refs=$(echo $push | awk '{ print $3}' | sed 's/\.\./\.\.\./')
+if [[ ! "$remote_url" =~ "github.com" ]]; then
+ repo_name=$(echo $remote_url | sed 's/.*\:\(.*\)\.git/\1/')
+ refs=$(echo $push | awk '{ print $3}' | sed 's/\.\./\.\.\./')
-github_url="https://github.com/$repo_name/compare/$refs"
-which -s pbcopy && echo $github_url | pbcopy && echo "Compare URL copied to clipboard!"
-# which -s open && open -g $github_url
-echo $github_url
+ github_url="https://github.com/$repo_name/compare/$refs"
+ which -s pbcopy && echo $github_url | pbcopy && echo "Compare URL copied to clipboard!"
+ # which -s open && open -g $github_url
+ echo $github_url
-echo
+ echo
+fi
exit 0
Please sign in to comment.
Something went wrong with that request. Please try again.