A simple Git alias setup

Here are a few simple but useful Git shortcuts that I use dozens of times a day.

TLDR: Add these to your .bashrc or .zshrc:

alias g='git'
alias gs='git status -sb'
alias glog="git log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
alias ga='git add'
alias gc='git commit -m'
alias gp='git push'

1. gs: Status

gs

gs output

I prefer this condensed status view over the default, but remove the -sb if you want the full version.

2. glog: Log Graph

glog

alt text

3. ga/gc/gp: Add/Commit/Push

ga content/posts/
gc "Add git shortcuts post"
gp

alt text

4. g: Short for git

Use for any other git command

g stash

There are many online resources with more comprehensive setups, but the ones below strike the right balance for me. Others that are interesting: