log/git aliases

If you're a frequent user of Git in your terminal, you might already be familiar with the power of ZSH. Personally, I rely on ZSH to streamline my Git commands, and one of my go-to tools for this is the ZSH plugin. However, there's another trick up my sleeve to supercharge Git commands even further – setting up custom aliases using Git configuration.

Setting up Git aliases using git config can significantly enhance your workflow. It not only saves keystrokes but also makes your Git commands more intuitive. If you're new to this concept, you can find detailed information in the Git documentation.

Let me share some of my favorite Git alias configurations:

 1# basic command
 2git config --global alias.co checkout
 3git config --global alias.ci commit
 4git config --global alias.st status
 5git config --global alias.br branch
 6
 7# log command
 8git config --global alias.lg "log --graph --oneline --all --decorate"
 9
10# show last commit
11git config --global alias.last "log -1 HEAD"
12
13# ammend last commit 
14git config --global alias.amend "commit --amend"
15
16# undo last commit
17git config --global alias.undo "reset HEAD~1 --mixed"
18
19# diff command
20git config --global alias.df diff
21git config --global alias.dc diff --cached
22
23# list branch (compact)
24git config --global alias.b "for-each-ref --format='%(refname:short)' refs/heads/"
25
26# list remote branch
27git config --global alias.lrb "branch -r"