Git Cheat Sheet & Command Generator

Browse, search, and copy Git commands by category.

  1. Home
  2. Web Dev
  3. Git Cheat Sheet

How to Use

  1. Browse commands — Scroll through the command cards grouped by category.
  2. Search — Type in the search box to filter commands by name, description, or example.
  3. Filter by category — Use the dropdown to show commands from a specific category.
  4. Copy — Click the copy icon on any card to copy the command to your clipboard.
  5. Use example — Click Use on any command card to quickly search for similar commands.

Frequently Asked Questions

What is the difference between git checkout and git switch?

git switch is a modern alternative introduced in Git 2.23 that only handles branch switching. git checkout is more versatile but can be confusing because it also restores files.

How do I undo a git commit?

Use git reset HEAD~1 to undo the last commit while keeping changes, or git reset --hard HEAD~1 to discard all changes. For public commits, use git revert instead.

What is the difference between git pull and git fetch?

git fetch downloads changes but does not integrate them. git pull downloads and immediately merges (or rebases with --rebase) changes into your current branch.