
Git Commands You Need to Know (The Complete Cheat Sheet)
I've been using Git for over a decade, and I still look up commands. Not because I'm forgetful -- because Git has a massive surface area and you only use 20% of it daily. The other 80% comes up when you're untangling a messy rebase at midnight or trying to find which commit introduced a bug. This is the cheat sheet I keep open in a terminal tab at all times. 1. Setup & Configuration git config --global user.name "Your Name" git config --global user.email "you@example.com" git config --global core.editor "code --wait" git config --global init.defaultBranch main git config --global alias.st status git config --global alias.lg "log --oneline --graph --decorate" git config --list Config Levels System ( --system ) -- /etc/gitconfig Global/user ( --global ) -- ~/.gitconfig Local/repo ( --local ) -- .git/config 2. Creating & Cloning Repos git init # Init repo in current directory git clone < ; url> ; # Clone repo git clone --depth 1 < ; url> ; # Shallow clone (latest commit only) git
Continue reading on Dev.to Tutorial
Opens in a new tab




