git commit --amend
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.
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.
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:

This method is so killer. I’ve never been able to get a handle of Capistrano, rsync, etc, so I can appreciate how easy this is get going. The hardest part for me was setting up Git on my server. Currently I’m employing the post-receive hook, which means I can push commits and then the server takes care of updating the site. I’m using this both on desandro.com and desandro.com/demo.
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 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)
I’ve been fiddling with a Gollum wiki and found a couple disappointments running locally.
These issues are all bummers considering how slick Jekyll is.
Head:
If you prefer, you can set these options via the commmand line (instead of editing the config file) like so:
$ git config branch.master.remote origin $ git config branch.master.merge refs/heads/masterOr, if you’re like me, and want this to be the default across all of your projects, including those you might work on in the future, then add it as a global config setting:
$ git config --global branch.master.remote origin $ git config --global branch.master.merge refs/heads/master
I’m trying out the global option as I never remember how to do this.
git cherry-pickshould be your answer here.