Skip to main content

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 Git
  • git help <command> → Get help for a specific command
  • git config --global user.name "Your Name" → Set your username globally
  • git config --global user.email "your@email.com" → Set your email globally
  • git config --list → View all configurations

Repository Management

  • git init → Initialize a new Git repository
  • git clone <repo-url> → Clone an existing repository
  • git remote add origin <url> → Add a remote repository
  • git remote -v → List remote repositories
  • git remote remove <name> → Remove a remote

Basic Snapshotting

  • git status → Show working directory status
  • git add <file> → Stage a file
  • git add . → Stage all changes
  • git reset <file> → Unstage a file
  • git commit -m "message" → Commit staged changes
  • git commit -am "message" → Add & commit tracked files in one step

Branching & Merging

  • git branch → List branches
  • git branch <name> → Create a new branch
  • git checkout <branch> → Switch to a branch
  • git checkout -b <branch> → Create & switch to a new branch
  • git merge <branch> → Merge a branch into current branch
  • git branch -d <branch> → Delete a branch
  • git branch -D <branch> → Force delete a branch

Remote Synchronizing

  • git fetch → Download objects & refs from remote
  • git pull → Fetch & merge from remote
  • git push origin <branch> → Push branch to remote
  • git push -u origin <branch> → Push branch & set upstream
  • git push → Push committed changes

Viewing History

  • git log → Show commit history
  • git log --oneline → Compact commit history
  • git log --graph --oneline --decorate → Visualize branch history
  • git show <commit> → Show details of a commit
  • git diff → Show unstaged changes
  • git diff --staged → Show staged changes

Undoing Changes

  • git checkout -- <file> → Discard changes in working directory
  • git reset HEAD <file> → Unstage a file
  • git 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 temporarily
  • git stash list → Show stashed changes
  • git stash apply → Reapply stashed changes
  • git stash drop → Delete a stash
  • git stash pop → Apply & remove stash

Advanced Commands

  • git rebase <branch> → Reapply commits on top of another base branch
  • git cherry-pick <commit> → Apply a specific commit to current branch
  • git tag <tagname> → Create a tag
  • git tag → List tags
  • git push origin <tag> → Push tag to remote

Tips, Tricks, Roadmaps, Resources, Networking, Motivation, Guidance, and Cool Stuff ♥

Updated on Dec 23, 2025