
Every Git Command You Need, With Examples You Can Actually Copy
I use Git every single day and I still look things up. There's no shame in it. Here's the reference I keep coming back to -- organized by workflow, with the flags you'll actually need. Setup & Configuration # Set your identity (do this first) git config --global user.name "Your Name" git config --global user.email "you@example.com" # Set default branch to main git config --global init.defaultBranch main # Enable colored output git config --global color.ui auto # Set VS Code as your editor git config --global core.editor "code --wait" # View all settings git config --list # Initialize a new repo git init # Clone an existing repo git clone https://github.com/user/repo.git # Shallow clone (just latest commit -- much faster) git clone --depth 1 https://github.com/user/repo.git # Clone a specific branch git clone --branch develop https://github.com/user/repo.git The Daily Workflow These are the commands you'll use dozens of times every day. Stage & Commit # Stage specific files git add inde
Continue reading on Dev.to DevOps
Opens in a new tab


