Git notes for zsh

Short reminder of the oh-my-zsh git plugin. Enable it, then the aliases below are enough for everyday commits and rebases. Full git still works; these are only shortcuts.

Enable the plugin

# ~/.zshrc
plugins=(git)

# or if you already have a list:
plugins=(git zsh-autosuggestions)

Reload with source ~/.zshrc or open a new terminal. Check with alias gst.

Status, diff, log

AliasRuns
gstgit status
gdgit diff
gdsgit diff --staged
glgit pull
gloggit log --oneline --decorate --graph

Stage and commit

AliasRuns
gagit add
gaagit add --all
gcmsggit commit --message
gc!git commit --verbose --amend
gpgit push
gpfgit push --force-with-lease

Branches

AliasRuns
gbgit branch
gcogit checkout
gcbgit checkout -b
gswgit switch
gswcgit switch --create
gmgit merge
grbgit rebase

Typical loop

gswc feat/short-name
# edit files
gaa && gcmsg "explain why, not what"
gp

Prefer gpf over a raw force-push. Skip gc! on commits that already left your machine.