My Git Aliases
published Jul 27, 2010
After you’ve been using Git for a while, you start to get kind of bored with typing
git commit -a -m "some message" all the time, and you never want to see this message ever again:
$> git stastus git: 'stastus' is not a git-command. See 'git --help'. Did you mean this? status
(why can’t you just do it for me!)
Ken had set up some nice aliases for git on his machine, so I totally stole them. My only regret is that it took me so long to do it. (I am glad that I didn’t do this right when I started using Git, though – it was worth while getting the long commands deeply ingrained into my memory before I started taking short cuts).
Here’s what I came up with:
alias gpom='git push origin master' alias st='git status' alias gppp='git pull peter master' alias gcam='git commit -a -m ' alias gd='git diff '
Obviously you don’t want the
git pull peter master one, but the rest are probably close to something you use all the time.
I also wanted one that replaces
git commit some_file some_other_file -m "commit message"
with something like
gcom some_file some_other_file "commit message"
but my bash-fu wasn’t strong enough, so I resorted to a quick Ruby script instead:
These are still a work in progress, and there’s nothing earth shattering here, but I thought I’d throw up a post just for the heck of it.