Git cheatsheet

Git is a decentralized version management software. With this cheatsheet, you will have quick access to the most common git commands.

About Git cheatsheet

A one-page Git cheat sheet with the commands you reach for most often, grouped by task: configuring Git, starting a repository, committing, undoing mistakes and miscellaneous day-to-day operations.

When you would use it

How to use it

  1. Scan the section headings for your task.
  2. Copy the command and replace the placeholders (branch names, file paths) with your own.
  3. Use the search in your browser (Ctrl+F) for a keyword.

Things worth knowing

Frequently asked questions

How do I undo my last commit but keep the changes?
git reset --soft HEAD~1 moves the branch back one commit and leaves the files staged. Use --mixed (the default) to also unstage them, and --hard only if you want to discard the changes.
What is the difference between git revert and git reset?
revert creates a new commit that undoes an earlier one, keeping history intact and safe to push. reset moves the branch pointer and rewrites history, so it is for local, unpushed commits.

All the tools