My .gitconfig

Here’s my current .gitconfig file. It’s very simple, but it makes using git so much better. git s is a simplified git status, and git l is a log that shows one-line commit messages and a tree that shows where branches and merges were made.

   ui = true 
   s = status -su 
   l = log --graph --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %an, %ar%Creset'

I also highly recommend you check out the table below, which I’ve copied from the bottom of the 10 things I hate about git post. It helps make sense of some common commands that I thought were useless as well. Adding the switches Steve Bennett recommends clears things up a bit.

Base commandUseless functionalityUseful commandUseful functionality
git branch fooCreates a branch but does nothing with itgit checkout -b fooCreates branch and switches to it
git remoteShows names of remotesgit remote -vShows names and URLs of remotes
git stashStores modifications to tracked files, then rolls them backgit stash -uAlso does the same to untracked files
git branchLists names of local branchesgit branch -rvLists local and remote tracking branches; shows latest commit message
git rebaseDestroy history blindfoldedgit rebase -iLets you rewrite the upstream history of a branch, choosing which commits to keep, squash, or ditch.
git reset fooUnstages filesgit reset –hard
git reset –soft
Discards local modifications
Returns to another commit, but doesn’t touch working directory.
git addNothing – prints warninggit add .
git add -A
Stages all local modifications/additions
Stages all local modifications/additions/deletions