Micro Cheatsheet
This cheatsheet is designed for learners of the Git & GitHub Masterclass by Happywala Engineer. It provides quick access to essential Git and GitHub commands, organized by category, to help you navigate, manage, and Git and GitHub effectively.
Setup & Configuration
git version→ Display the installed version of Gitgit help <command>→ Get help for a specific commandgit config --global user.name "Your Name"→ Set your username globallygit config --global user.email "your@email.com"→ Set your email globallygit config --list→ View all configurations
Repository Management
git init→ Initialize a new Git repositorygit clone <repo-url>→ Clone an existing repositorygit remote add origin <url>→ Add a remote repositorygit remote -v→ List remote repositoriesgit remote remove <name>→ Remove a remote
Basic Snapshotting
git status→ Show working directory statusgit add <file>→ Stage a filegit add .→ Stage all changesgit reset <file>→ Unstage a filegit commit -m "message"→ Commit staged changesgit commit -am "message"→ Add & commit tracked files in one step
Branching & Merging
git branch→ List branchesgit branch <name>→ Create a new branchgit checkout <branch>→ Switch to a branchgit checkout -b <branch>→ Create & switch to a new branchgit merge <branch>→ Merge a branch into current branchgit branch -d <branch>→ Delete a branchgit branch -D <branch>→ Force delete a branch
Remote Synchronizing
git fetch→ Download objects & refs from remotegit pull→ Fetch & merge from remotegit push origin <branch>→ Push branch to remotegit push -u origin <branch>→ Push branch & set upstreamgit push→ Push committed changes
Viewing History
git log→ Show commit historygit log --oneline→ Compact commit historygit log --graph --oneline --decorate→ Visualize branch historygit show <commit>→ Show details of a commitgit diff→ Show unstaged changesgit diff --staged→ Show staged changes
Undoing Changes
git checkout -- <file>→ Discard changes in working directorygit reset HEAD <file>→ Unstage a filegit reset --hard→ Reset to last commit (discard all changes)git revert <commit>→ Create a new commit that undoes changes
Stashing in Git
git stash→ Save changes temporarilygit stash list→ Show stashed changesgit stash apply→ Reapply stashed changesgit stash drop→ Delete a stashgit stash pop→ Apply & remove stash
Advanced Commands
git rebase <branch>→ Reapply commits on top of another base branchgit cherry-pick <commit>→ Apply a specific commit to current branchgit tag <tagname>→ Create a taggit tag→ List tagsgit push origin <tag>→ Push tag to remote

Updated on Dec 23, 2025