Skip to content
hateitall

Git Command Reference

Find the right git command by describing what you want, with the risky ones clearly marked.

Processed locallyIn: TextOut: Command

Loading tool…

How to use git command reference

  1. Type what you want to do, such as undo commit or rename branch.

  2. Narrow by topic if you like: branches, sync, history, undo, stash, tags or config.

  3. Read the note under each command for when to use it.

  4. 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.

Combine .gitignore templates for languages, editors and OSes, then test paths

Selection · Text→ gitignoreLight on device

Build and check commit messages with type, scope, breaking changes and footers

Text→ Commit messageLight on device

Clean branch names from a ticket and description, checked against git rules

Text→ Branch nameLight on device

Owner, repo, branch and path from any GitHub link, plus raw, clone and ZIP links

URL · Text→ LinksLight on device