Created
March 13, 2012 09:39
-
-
Save 0x000000/2027857 to your computer and use it in GitHub Desktop.
Open current github repo from console
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
function git_branch() { | |
git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' | |
} | |
function github() { | |
giturl=$(git config --get remote.origin.url) | |
if [ "$giturl" == "" ] | |
then | |
echo "Not a git repository or no remote.origin.url set" | |
exit 1; | |
fi | |
giturl=${giturl/git\@github\.com\:/https://github.com/} | |
giturl=${giturl/\.git//} | |
giturl=$giturl"tree/"$(git_branch) | |
echo $giturl | |
open $giturl | |
} | |
# In addition: | |
export PS1="\w [\$(git_branch)]\$ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
By simple typing $ github in console.