Get some git aliases

Here is my ~/.gitconfig for aliases - which could probably be improved.

[alias]
    d = diff -b
    br = branch -av
    st = status
    ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
    lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
    pf = !git pull && git fetch --all -p
    sb = submodule update --init --recursive

Explanation

  • git d will show you the differences between files, without spaces.
  • git br will show you local and remote branches with last commit.
  • git st will show your current working state.
  • git ls will show a pretty log.
  • git lg will show a prettier log (including the date of commit).
  • git pf will pull from current branch and fetch everything, pruning.
  • git sb will update your submodules.

Dont forget you can also set the color in your terminal!