So You Think You Know Git

David Lee
3 min readApr 24, 2024

I’ve been working with Git for a while and for a long time I did not know I could take the Git use to the next level. I thought Git is merely add, commit push and pull. And I could survive most of the time with these simple command, until …

Here is the list of my git tools that have taken my work skill to the next level, and I hope it will help you too.

Set below for your .gitconfig file:


[alias]
graph = log --oneline --graph --decorate
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
conflicts = diff --name-only --diff-filter=U
local-branches = !git branch -vv | cut -c 3- | awk '$3 !~/\\[/ { print $1 }'
recent-branches = !git branch --sort=-committerdate | head
authors = !git log --format='%aN <%aE>' | grep -v 'users.noreply.github.com' | sort -u --ignore-case
search = "!f() { git rev-list --all | xargs git grep -F \"$1\"; }; f"
dl = "!git ll -1" # Show modified files in last commit:latest commit
dlc = diff --cached HEAD^ # Show modified files in last commit:latest commit
dr = "!f() { git diff "$1"^.."$1"; }; f" # git dr <commit-id>
lc = "!f() { git ll "$1"^.."$1"; }; f" # git lc <commit-id> #…

--

--

David Lee

Gopher and Rustacean -- > ⾶ 🤺 I use VIM btw 🤫