This dev workflow cheat sheet covers the Git commands you’ll actually use day to day — the daily save-and-share loop, branching, pull requests, deploys, and the handful of “undo” commands that get you out of trouble. Bookmark it and skip the 40-tab search spiral.
The daily flow (the 4 you’ll use most)
Ninety percent of Git is these four commands, in this order: see what changed, stage it, save a snapshot, send it up.
git status # what's changed
git add . # stage all changes (or: git add <file>)
git commit -m "message" # save a snapshot
git push # send commits to the remote
Branching
A branch is a safe, separate copy of your work, so you don’t touch the main code until it’s ready.
git checkout -b feature/thing # create + switch to a new branch
git checkout main # switch to an existing branch
git branch # list local branches
git branch -d feature/thing # delete a merged branch
git branch -D feature/thing # force-delete (unmerged)
Getting other people’s work
git pull # fetch + merge remote into your current branch
git fetch # download remote changes without merging
git pull --rebase # replay your commits on top (cleaner history)
Merging
Merging brings one branch’s work into another.
git checkout main # go to the branch you want to merge INTO
git merge feature/thing # bring feature/thing in
# conflict? edit the files, then: git add <file> → git commit
git merge --abort # bail out of a messy merge
Pull requests (PRs)
A pull request is a request to merge one branch into another, reviewed on GitHub or GitLab before it lands.
git push -u origin feature/thing # push the branch, then open a PR in the web UI
gh pr create # open a PR from the terminal (GitHub CLI)
gh pr status # see your open PRs
gh pr merge # merge an approved PR
The typical lifecycle: branch → commit → push → open PR → review → merge → delete branch.
Deploying
Deploy steps vary by setup — it’s usually one of these:
git push origin main # auto-deploy on push (Vercel, Netlify, Heroku)
vercel --prod # manual deploy (Vercel)
npm run deploy # project-specific script
Check your project’s README or CI config for the real command.
Undo & fix mistakes
The commands that get you out of trouble — worth memorizing before you need them.
git commit --amend # edit the last commit (before pushing)
git reset --soft HEAD~1 # undo last commit, keep changes staged
git restore <file> # discard unstaged changes to a file
git revert <commit> # new commit that undoes an old one (safe)
git stash # shelve changes; git stash pop to bring them back
Common terms, in plain English
- origin — the default name for your remote repo
- HEAD — your current commit / position
- main (or master) — the primary branch
- conflict — the same lines changed two ways; you pick the winner
- CI — automated tests/builds that run on push or a PR