IT Pro Toolkit · Reference

Git & GitHub Cheat Sheet for Beginners

The everyday Git commands, in the order you actually use them — clone, branch, commit, push, pull, merge, and the all-important "undo what I just did." Plain English, no gatekeeping.

Updated July 2026 · ~6 min read

Git has a reputation for being confusing, but 90% of daily work runs on about fifteen commands. Learn these and you can contribute to any project with confidence. Here they are, grouped by what you're doing.

Starting out

CommandWhat it does
git clone urlCopy a remote repo to your machine
git initTurn the current folder into a repo
git statusSee what's changed, staged, and untracked
git config --global user.name "You"Set your commit identity

The daily loop

CommandWhat it does
git add .Stage all changes for the next commit
git commit -m "message"Save staged changes with a note
git pushSend your commits to GitHub
git pullFetch and merge others' changes
git log --onelineSee the commit history, one line each

Branches

CommandWhat it does
git switch -c featureCreate and move to a new branch
git switch mainMove back to the main branch
git merge featureMerge a branch into your current one
git branch -d featureDelete a merged branch
The one everyone Googles: git restore file throws away uncommitted changes to a file, and git reset --soft HEAD~1 undoes your last commit but keeps the changes. Learn these two and Git stops being scary.

Undo & fix

CommandWhat it does
git restore fileDiscard uncommitted changes to a file
git reset --soft HEAD~1Undo the last commit, keep the changes
git revert commitMake a new commit that undoes an old one
git stash / git stash popShelve changes, then bring them back

Keep the printable Git cheat sheet nearby

The Git & GitHub Cheat Sheet for Beginners is a clean one-pager: every command here plus a visual of the add → commit → push flow and the fixes for the mistakes beginners actually make. Instant download.

Get the cheat sheet →