Combine .gitignore templates for languages, editors and OSes, then test paths
Git Command Reference
Find the right git command by describing what you want, with the risky ones clearly marked.
Loading tool…
How to use git command reference
Type what you want to do, such as undo commit or rename branch.
Narrow by topic if you like: branches, sync, history, undo, stash, tags or config.
Read the note under each command for when to use it.
Copy the command and replace the parts in angle brackets.
What this tool does
- More than 50 commands written as tasks, from starting a repository to recovering lost commits.
- A full set of undo recipes: unstage, amend, reset, revert, reflog and abort.
- Commands that rewrite history or delete work are labelled, and can be hidden.
- Search matches the task, the command and the explanation.
How the result is verified
Commands use current git syntax (git switch and git restore, added in git 2.23). Check your version with git --version if a command is not recognised.
Frequently asked questions
What is the safest way to undo a commit that is already pushed?
git revert <commit>. It adds a new commit that reverses the old one, so nobody else's history changes. reset and rebase rewrite history and should only be used on commits you have not shared.
I ran git reset --hard by mistake. Is my work gone?
Committed work usually is not. Run git reflog to find where the branch was before, then git reset --hard to that hash. Uncommitted changes that were never staged cannot be recovered this way.
Is my data uploaded to a server?
No. Everything you drop, paste or type is processed by code running in this browser tab. You can check it yourself: open your browser's developer tools, watch the Network panel, and use the tool. No request carries your data.
Related tools
Build and check commit messages with type, scope, breaking changes and footers
Clean branch names from a ticket and description, checked against git rules
Owner, repo, branch and path from any GitHub link, plus raw, clone and ZIP links