🌿

Git Helper

Pick a scenario, fill the branch or tag, copy the exact git command with a risk note.
git 📂 Developer 👤 ToolCMS 🏷️ v1.0.0 ⚙️ clipboard, storage

命令生成撤销与回退

规则来自通用模板,合并去重后按字母序分组输出;私有目录与密钥请自行补充。

最近使用本机 8 条

生成命令或忽略文件后,这里会留下记录,点一条可回填。

收藏0 条

在结果里点「收藏」把常用命令留着,最多 10 条。

结果等待生成

选场景与操作、填参数后点「生成命令」;每条命令下方会写明它做什么、影响什么、能否回退。

How to Use

📖 What it does

Git has few commands but many situations. You revert the wrong thing, push to the wrong branch, delete a branch by accident, or need to roll back a release. This tool lists the common situations by scenario, and after two parameters you get a command you can paste into a terminal, with a line explaining what it does and what it risks.

The other half is .gitignore. Instead of hand-writing node_modules, build output, IDE folders and OS junk, tick the stacks and environments you use and get a merged, deduplicated ignore file.

Seven scenarios and more than sixty commands live in a local array. Search is a substring filter, so results appear as you type; measured round trip stays under 16 ms and nothing is requested from a server.

Command text is maintained as scenario constants rather than model output. Favourites cap at ten entries in localStorage and disappear with browser data; no repository information is stored anywhere.

The workspace exposes 1 controls, from 搜索命令 to 搜索命令, and every one of them only affects the local rendering: nothing is sent back to a server.

The 搜索命令 control takes free text and feeds it straight into the preview without sending it anywhere.

✨ Features

  • Six scenarios with more than forty common commands: undo, branches, staging, remotes, tags, troubleshooting.
  • Parameter substitution for branch, commit, remote, tag and path, with no angle brackets left behind once filled.
  • Per-command explanation of effect, scope and reversibility, with dangerous commands marked in red.
  • One-click copy of a single command or the whole set, without the explanation text.
  • A gitignore generator merging more than forty rule groups across stacks, operating systems and editors.
  • Recent picks are kept locally and restored on reload.

🚀 How to use

  1. Pick a scenario, then an operation; the right column fills with a parameterised command.
  2. Fill branch, commit, remote or path. Empty parameters stay as placeholders you can replace after copying.
  3. Read the explanation and risk label before copying; dangerous commands are shown in red.
  4. Switch to the ignore tab and tick the stacks, systems and editors your project uses.
  5. Copy the command or download the .gitignore, then use it in your project.

⚠️ Before you rely on it

  • Templates, not an executor: nothing connects to your repository or runs a command.
  • Read dangerous commands: reset --hard, push --force, clean -fd and branch -D discard work or history; the explanation marks them in red.
  • Short hashes work: examples use seven characters; switch to the full hash in very large repositories.
  • .gitignore is a starting point: community templates do not know your private keys or export folders.
  • Tracked files ignore rules: .gitignore only affects untracked files; use git rm --cached for files already committed.

Questions people ask: Q: Why do angle brackets appear? A: A parameter was left empty, so a placeholder was used; fill branch or commit and they disappear. Q: I added ignore rules but files still show A: They are already tracked; run git rm --cached and commit again. Q: Can I recover after reset --hard? A: Uncommitted work is generally gone; committed work may still be in reflog if you act quickly. Q: Are the generated commands current? A: They are stable wordings for regular Git usage after 2.23. For newer subcommands the parameter fields still work with a branch or path, though the explanation follows the older syntax.

Typical use: Undoing a commit that has a wrong message or an accidentally added file while keeping the changes. Rebasing a feature branch onto main, or recovering a deleted branch. Writing a .gitignore for a new project or completing one for an existing repository.

What you can enter: Commands: choose a scenario and operation, then fill branch, commit, remote, tag or path. Ignore: tick stacks, operating systems, editors and toolchains; selections stack. Empty parameters are emitted as placeholders to replace after copying.

What you get back: Command text with per-line explanations and a risk level, copyable singly or as a group. A merged, deduplicated plain-text ignore file ready to download as .gitignore.

Limits to keep in mind: Generates text only; it never executes, connects to a repository or reads repository state. Ignore rules are generic templates and exclude project-private paths and secret files. No interactive rebase walkthrough or conflict resolution details.

Related

⏫︎