GitHub message commit link

Quickly link to a commit in a GitHub message. SHA: followed by the first 7 or so of the commit SHA for that project will be converted into a link. For example, I just dropped:

SHA: 49b5c3a6eb509

which became - SHA: 49b5c3a

More goodies in GitHub Flavored Markdown. You can also quickly reference other projects and branches.

git config —get remote.origin.url

Here’s a faster way to get the URL of a remote git repo, using git config:

git config --get remote.origin.url
# >> git@github.com:desandro/dropshado.ws.git

Or to get list all the options of local .git/config:

git config --local -l
# >> core.repositoryformatversion=0
# >> core.filemode=true
# >> core.bare=false
# >> core.logallrefupdates=true
# >> core.ignorecase=true
# >> remote.origin.url=git@github.com:desandro/dropshado.ws.git
# >> remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
# >> branch.gh-pages.remote=origin
# >> branch.gh-pages.merge=refs/heads/gh-pages

See previous method git remote show origin.

.gitconfig colors

Aw yeah, another command-line coloring post!

John Schulz pointed me to this git cheat sheat (via Rebecca Murphey). Right up front it provides the settings in ~/.gitconfig to color git command output like git diff, git status, and git branch. Here’s what I’m rocking:

[core]
  quotepath = false
  whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol
[color]
  ui = true
[color "branch"]
  current = yellow black
  local = yellow
  remote = magenta
[color "diff"]
  meta = yellow bold
  frag = magenta bold
  old = red reverse
  new = green reverse
  whitespace = white reverse
[color "status"]
  added = yellow
  changed = green
  untracked = cyan reverse
  branch = magenta

Which looks like:

color git commands

Git create and checkout new branch

Use the -b flag with git checkout to create and checkout a new branch in one command.

# old way
git branch newbranch
git checkout newbranch

# new way
git checkout -b newbranch

git remote show origin

git remote show origin displays info for your remote origin repo. I typically use this when I want to get the URL or the remote repo. Here’s what I get in my HTML5 Boilerplate repo:

$ git remote show origin
warning: more than one branch.master.remote
* remote origin
  Fetch URL: git://github.com/paulirish/html5-boilerplate.git
  Push  URL: git://github.com/paulirish/html5-boilerplate.git
  HEAD branch: master
  Remote branches:
    master   tracked
    mobile   tracked
    stripped tracked
  Local branch configured for 'git pull':
    master merges with remote master
              and with remote master
  Local ref configured for 'git push':
    master pushes to master (local out of date)

Gollum wiki downers

I’ve been fiddling with a Gollum wiki and found a couple disappointments running locally.

  • Changes must be committed in the git repo before they are seen in the wiki.
  • Gollum only runs from master branch. Issue 94. Coupled with the previous issue, this prevents any way to preview changes. If you wish to view changes, you must commit to the master branch.
  • If the Home page is missing, no table of contents will be automatically generated (as they are on GitHub). Issue 74
  • Sidebars are not added to pages (as they are on GitHub). Issue 97

These issues are all bummers considering how slick Jekyll is.