Skip to content

Instantly share code, notes, and snippets.

@stephenturner
Last active August 29, 2015 14:16
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephenturner/d291570e25ee797580a4 to your computer and use it in GitHub Desktop.
Save stephenturner/d291570e25ee797580a4 to your computer and use it in GitHub Desktop.
[include]
# For user/credentials/token/etc
path = ~/.gitconfig.local
[core]
editor = vim
excludesfile = ~/.gitignore
[color]
branch = auto
diff = auto
status = auto
ui = auto
[alias]
ci = commit
co = checkout
br = branch
st = status
ss = status -sb
pom = push origin master
dwd = diff --word-diff
l = log --decorate --graph --abbrev-commit --date=relative --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
ld = log --decorate --graph --abbrev-commit --date=short --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'
hub = !open $(echo $(git config --get remote.origin.url) | perl -pe \"s|git\\@github\\.com:|https://github.com/|\")
page= !open $(echo $(git config --get remote.origin.url) | perl -pe \"s|git\\@github\\.com:|https://github.com/|\" | perl -pe 's|https://github\\.com/(\\w+)/|http://$1.github.io/|' | perl -pe 's|\\.git$||g')

The last two aliases need some explanation. Only tested on Mac OSX.

git hub: Opens the current repo on GitHub in your web browser. It first runs git config --get remote.origin.url to get the URL for the origin remote, then does some regex processing with perl to turn the remote URL to something like https://github.com/user/project.

git page: Launches the project page if you have one on gh-pages. If your GH repo lives at https://github.com/user/project, this will launch http://user.github.io/project in your default browser.

@boydgreenfield
Copy link

That last one is... fantastic. Thanks!

@rmflight
Copy link

Very cool. You can change open to google-chrome on linux and it will open a new tab in your current session

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