1. Home
  2. Developer tools
  3. Git Command Finder

Git Command Finder

Find the right command when Git has gone wrong, written for current Git with switch and restore, and with the risky ones clearly marked.

Free, no sign-up. Runs in your browser: nothing is uploaded.

How to use Git Command Finder

  1. Type what you want to do, or pick a topic.
  2. Read the note under the recipe.
  3. Copy the commands and replace the placeholders.

Features

  • 33 recipes: undo, recover, branches, history, stash, files, inspect and releases
  • Reflog recovery for bad resets, rebases and deleted branches
  • Destructive commands flagged with a red badge
  • Modern git switch and git restore
  • --force-with-lease instead of --force

Supported formats

Input

  • Typed or pasted text

You get

  • Copied text

Private by design

Everything you enter is processed by your browser on this device. Nothing is sent to openWorkstand or anyone else, so the Git Command Finder is safe for private and work data. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • Recipes cover common tasks; placeholders such as <sha> and branch names must be replaced.

Guide

Undoing and recovering in Git: the commands for common situations

Git rarely loses work, but it is easy to get into a state where you do not know how to get out: a commit on the wrong branch, a reset that went too far, a branch deleted a moment too soon. The right command usually exists and is short, but finding it under pressure is hard. This finder lists 33 recipes for common situations, searchable in plain English, with the risky ones clearly marked.

How the finder is organised

Recipes are grouped by the job: undoing changes, recovering lost work, managing branches, rewriting history, putting work aside, dealing with files, inspecting history, tagging releases and basic setup. Type what you want in your own words, such as “undo commit” or “deleted branch”; every word must appear in the task, the command, the note or the group, so adding words narrows the list. Each recipe shows the commands, a copy button and a note on what to watch for.

Rewrite or add a commit

Most undo recipes come in two flavours. Commands such as git reset and git commit --amend rewrite history: they are perfect for commits that only exist on your machine. Commands such as git revert add a new commit that reverses an old one and are the safe choice once a commit has been pushed, because other people’s clones still contain the original. When you do rewrite a pushed branch, the recipes use git push --force-with-lease, which refuses to overwrite commits someone else pushed in the meantime.

The reflog is the safety net

Every time HEAD moves, through commits, resets, rebases, checkouts or merges, Git records the previous position in the reflog. git reflog lists those positions with short descriptions, and git reset --hard HEAD@{2} or git branch rescue <sha> brings any of them back. The Recover group is built around it, along with git fsck for dropped stashes.

Branches, stashes and worktrees

The Branches group covers creating, renaming and deleting branches locally and on the remote, pruning references to deleted remote branches and moving commits made on the wrong branch. Work in progress covers git stash push -u with a message and git worktree add, which checks out a second branch in another folder so you can fix something urgent without stashing.

A worked example

Searching “deleted branch” shows “Restore a deleted branch” with two commands: git reflog, then git branch feature <sha>. Find the last commit of the deleted branch in the reflog, usually the entry just before you switched away from it, and create a new branch pointing at that commit; the work comes back exactly as it was. With the search box empty, all 33 recipes are listed.

Destructive commands

Recipes that throw away uncommitted work, such as discarding all local changes with git reset --hard and git clean -fd, or rewriting all history to remove a secret, carry a red “Destroys work” badge and a note. Before running one, create a safety branch with git branch backup-now; it costs nothing and makes the operation reversible for committed work. Changes that were never committed or stashed cannot be recovered afterwards.

Habits that make mistakes cheap

Commit early on a branch, even with rough messages you will squash later; committed work is recoverable. Fetch before rebasing, read git status before destructive commands, and prefer git switch and git restore, which separate switching branches from discarding file changes, over the older all-purpose git checkout.

Checked against the current version of the Git Command Finder on .

Frequently asked questions

What does HEAD~1 mean?

The first parent of the commit you are on, in other words the commit before it. HEAD~3 goes back three commits along first parents. HEAD^2 means the second parent of a merge commit, which is a different thing.

How long does Git keep commits that no branch points to?

Unreachable commits stay in the reflog for 30 days and reachable reflog entries for 90 days by default, and git gc removes them only after that. Inside that window, a commit you lost with a reset or rebase can almost always be found again.

I ran git reset --hard by mistake. Is my work gone?

Committed work is almost always recoverable: git reflog lists every commit HEAD pointed to, and git reset --hard HEAD@{1} goes back. Uncommitted changes that were never staged are lost, which is why git stash first is a good habit.

What is the difference between reset and revert?

reset moves the branch pointer and rewrites history, which is fine for local commits. revert adds a new commit that undoes an old one, which is the safe choice for commits already pushed and shared.

Keep working with the result

openWorkstand also includes a free workspace with documents, spreadsheets, tasks, projects and a calendar that save to a folder on your computer.