explaingit

k88hudson/git-flight-rules

42,479Audience · developerComplexity · 1/5QuietLicenseSetup · easy

TLDR

A practical reference guide for fixing common Git mistakes, organized by real-world problems you encounter rather than Git concepts.

Mindmap

mindmap
  root((repo))
    What it does
      Problem-based guide
      Git troubleshooting
      Command solutions
    Problem categories
      Commits and messages
      Staged and unstaged
      Branches and merging
      Recovery and undo
    Use cases
      Fix wrong commit
      Undo staged changes
      Recover lost work
      Track down bugs
    How to use
      Look up your problem
      Copy exact commands
      Apply the fix

Things people build with this

USE CASE 1

Quickly fix a commit message you wrote incorrectly without losing your work.

USE CASE 2

Recover accidentally deleted branches or commits that seemed lost forever.

USE CASE 3

Find and remove sensitive data like passwords you committed by mistake.

USE CASE 4

Undo a merge or rebase that went wrong and get back to a working state.

Tech stack

GitMarkdown

Getting it running

Difficulty · easy Time to first run · 5min
Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

Git Flight Rules is a practical reference guide for handling common and not-so-common problems you encounter while using Git, the version control system. The name comes from the aviation industry, where "flight rules" are detailed, scenario-specific procedures recorded over decades of real incidents, step-by-step guides for what to do when something goes wrong. The author applies the same concept to Git: a cookbook of situations and their exact solutions. The document is organized entirely around specific problems rather than Git concepts. Each section title is phrased as a real scenario a developer might face: "I wrote the wrong thing in a commit message," "I accidentally committed sensitive data," "I pulled from the wrong branch," or "I need to undo changes I accidentally staged." Under each heading you find the exact Git commands to fix the situation, with brief explanations of what each command does and why. Topics covered include editing recent and historical commits, managing staged and unstaged changes, branch operations, merging and rebasing, handling submodules, managing remotes, tracking down bugs with bisect, and recovering from situations that seem irreversible like accidental hard resets. The guide is written as plain documentation, no installable software, no code libraries. Someone would use this repository when they have made a mistake in Git and need to fix it quickly without having to understand every underlying concept from scratch. It is especially valuable for developers who use Git daily but encounter edge cases they haven't memorized, the format is designed for looking up the exact solution to a specific problem at the moment you need it. The guide requires no particular tech stack, it is plain Markdown documentation covering standard Git command-line usage.

Copy-paste prompts

Prompt 1
I just committed to the wrong branch. Using git-flight-rules, what are the exact steps to move my commits to the correct branch?
Prompt 2
I accidentally did a hard reset and lost my commits. Show me the git-flight-rules approach to recover them.
Prompt 3
I committed my API keys by mistake. Walk me through the git-flight-rules solution to remove them from history.
Prompt 4
I staged the wrong files. What does git-flight-rules say to unstage them without losing my changes?
Prompt 5
I merged the wrong branch into main. Using git-flight-rules, how do I undo this merge?
Open on GitHub → Explain another repo

Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.