-
-
Save smathy/1269148 to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
current_git_branch() { | |
git_exists=`git branch 2>/dev/null | sed -ne'/^\* /s///p'` | |
if [[ "$git_exists" != "" ]]; then | |
if [[ "$git_exists" == "(no branch)" ]]; then | |
git_exists="\e[31m\]$git_exists\e[0m\]" | |
fi | |
echo "$git_exists " | |
fi | |
unset git_exists | |
} | |
extra="$1" | |
if [[ "$extra" == "" ]]; then | |
extra=$(current_git_branch) | |
else | |
extra=$(git rev-parse $1) | |
fi | |
extra="/commits/$extra" | |
open `git config -l | sed -En 's/remote.origin.url=git(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\3\/\4/p'`$extra |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added the
current_git_branch
code inline.