T
Tooltastic
Git Cheatsheet – Complete Command Reference | Tooltastic
Git Reference

Git Cheatsheet

Every Git command you need — searchable, copyable, always at hand

60+ Commands Searchable Free
commands

What is Git?

Git is a distributed version control system created by Linus Torvalds in 2005. It tracks changes in source code, enables collaboration among teams, and allows you to revert to any previous state of your project at any time.

Git vs SVN

Unlike SVN (centralized), Git is fully distributed — every developer has a complete copy of the repository. Git is faster for most operations, works offline, and makes branching and merging significantly easier.

Essential Git Workflow

The typical Git workflow: git pull to get latest changes, git checkout -b to create a feature branch, make your changes, git add and git commit to save them, then git push and open a pull request for code review.

Frequently Asked Questions about Git

Everything you need to know about Git commands and workflows

git fetch downloads changes from the remote repository but does NOT merge them into your working branch. git pull is essentially git fetch followed by git merge — it downloads and immediately integrates the remote changes. Use git fetch when you want to review changes before merging, and git pull when you trust the remote and want to update quickly.

Use git reset --soft HEAD~1 to undo the last commit while keeping all your changes staged. Use git reset --mixed HEAD~1 (or just git reset HEAD~1) to undo the commit and unstage the changes, leaving them in your working directory. Use git reset --hard HEAD~1 only if you want to completely discard the last commit and all its changes — this is irreversible.

Use rebase when you want a clean, linear commit history — common for feature branches before merging into main. Rebasing rewrites commit history, making it look as if you always branched from the latest version of main. Use merge when you want to preserve the full history of how changes were integrated, especially on shared branches. Never rebase commits that have already been pushed to a shared remote branch.

git reset moves the HEAD pointer back to a previous commit, effectively removing subsequent commits from the history (dangerous on shared branches). git revert creates a new commit that undoes the changes of a specific commit — the history is preserved and it is safe to use on shared/public branches. Prefer git revert for anything that has already been pushed.