My Gitconfig Aliases

Often I find myself typing the same Git commands over and over again. Rather than waste extra keystrokes on these commands, I made this gitconfig with the help of the Internet to save time. I’ve been using this since last summer, and I hope you find this useful.

[alias]
    # Viewing formatted logs
    ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
    ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
    lg = log --oneline --decorate
    l = log --pretty=format:"%h\\ %s\\ [%cn]"

    # Staging and committing
    a = add
    aa = add -A
    au = add -u
    c = commit
    cm = commit -m
    ca = commit --amend

    # Viewing diffs and status
    d = diff
    ds = diff --staged
    dlc = diff --cached HEAD^
    st = status
    ss = status -s

    # Branching and checkouts
    b = branch
    co = checkout
    cob = checkout -b

    # Viewing remotes
    r = remote
    rv = remote -v

    # Viewing all Git aliases
    la = "!git config -l | grep alias | cut -c 7-"