{"id":51118918,"url":"https://github.com/sulthonzh/gitpanic","last_synced_at":"2026-06-25T00:30:32.784Z","repository":{"id":360042537,"uuid":"1248412506","full_name":"sulthonzh/gitpanic","owner":"sulthonzh","description":"Interactive CLI that diagnoses git mistakes and guides you through recovery. Reflog-powered undo wizard.","archived":false,"fork":false,"pushed_at":"2026-06-24T21:15:19.000Z","size":348,"stargazers_count":0,"open_issues_count":8,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-24T23:07:41.300Z","etag":null,"topics":["cli","developer-tools","git","recovery","reflog","terminal","undo","wizard"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sulthonzh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-24T15:57:55.000Z","updated_at":"2026-06-18T01:20:02.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sulthonzh/gitpanic","commit_stats":null,"previous_names":["sulthonzh/gitpanic"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/sulthonzh/gitpanic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulthonzh%2Fgitpanic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulthonzh%2Fgitpanic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulthonzh%2Fgitpanic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulthonzh%2Fgitpanic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sulthonzh","download_url":"https://codeload.github.com/sulthonzh/gitpanic/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulthonzh%2Fgitpanic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34755061,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-24T02:00:07.484Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","developer-tools","git","recovery","reflog","terminal","undo","wizard"],"created_at":"2026-06-25T00:30:32.703Z","updated_at":"2026-06-25T00:30:32.778Z","avatar_url":"https://github.com/sulthonzh.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gitpanic\n\nInteractive CLI that diagnoses git mistakes and guides you through recovery — like `git reflog` but human-friendly.\n\n## Why gitpanic?\n\nEvery developer has panicked after a bad git operation. Stack Overflow's top git questions are all \"how do I undo...\":\n- \"How to undo last commit\" — 16k+ upvotes\n- \"How to undo git push\" — 5k+ upvotes\n- \"How to recover deleted branch\" — 3k+ upvotes\n- \"How to undo git merge\" — 2k+ upvotes\n\n`git reflog` is powerful but intimidating. `gitpanic` provides an interactive wizard that:\n1. **Auto-detects** common git disasters from your repository state\n2. **Diagnoses** the problem in plain English\n3. **Guides** you through recovery with risk levels and confirmations\n4. **Protects** you by never executing without confirmation\n\n## Installation\n\n```bash\nnpm install -g gitpanic\n```\n\nOr use with npx:\n\n```bash\nnpx gitpanic\n```\n\n## Usage\n\n### Basic Scan\n\nRun `gitpanic` in any git repository:\n\n```bash\n$ gitpanic\n🔍 Analyzing your git state...\n\n⚠️  Found 1 potential issue:\n\n1. 🟢 Uncommitted Changes\n   You have 3 uncommitted files. 1 staged. 2 modified.\n   Confidence: 100%\n\nSelect an issue to fix [1-1] or press Enter to exit: 1\n\n🔧 Recovery options for: Uncommitted Changes\n\n1. ✅ Stash changes\n   Save your changes to apply later\n   Risk: safe\n   Steps:\n   - git stash push -m \"WIP\"\n\n2. ✅ Commit changes\n   Create a commit with your changes\n   Risk: safe\n   Steps:\n   - git add .\n   - git commit -m \"WIP\"\n\n3. ⚠️ Discard all changes\n   Remove all uncommitted changes (DANGEROUS)\n   Risk: high\n   Steps:\n   - git reset --hard HEAD\n   - git clean -fd\n\nSelect a recovery option [1-3]: 1\n⚠️  Confirm: \"Stash changes\"? This can be undone. [y/N]: y\n\n🚀 Executing recovery...\n\n✅ Recovery complete!\n```\n\n### Dry Run Mode\n\nPreview what would happen without making changes:\n\n```bash\ngitpanic --dry-run\n```\n\n### Timeline\n\nSee your recent git operations in plain English — way more readable than `git reflog`:\n\n```bash\n$ gitpanic timeline\nRecent git operations:\n\n  ↗ checkout  main → fix/login-bug  (a1b2c3d, 2m ago)\n  ✓ commit    add login validation    (e4f5g6h, 5m ago)\n  ✓ commit    wip: login form          (i7j8k9l, 12m ago)\n  ↗ checkout  develop → main          (m0n1o2p, 1h ago)\n  ↓ pull      Fast-forward            (q3r4s5t, 2h ago)\n```\n\nOptions:\n```bash\ngitpanic timeline --limit 10     # Show last 10 operations (default: 20)\ngitpanic timeline --json         # JSON output for scripting\ngitpanic timeline --markdown     # Markdown table for docs/PRs\n```\n\nGreat for answering \"wait, what did I just do?\" without deciphering raw reflog output.\n\n### Non-Interactive Mode\n\nFor use in scripts (requires manual implementation of recovery options):\n\n```bash\ngitpanic --non-interactive\n```\n\n## Detected Disasters\n\n`gitpanic` can detect and recover from:\n\n| Disaster | Description | Severity |\n|----------|-------------|----------|\n| **Detached HEAD** | You're in detached HEAD state | Medium |\n| **Deleted Branch** | A branch was recently deleted | High |\n| **Force Push** | You recently force-pushed (may have overwritten commits) | High |\n| **Botched Merge** | Merge in progress or recently aborted | Medium |\n| **Accidental Commit** | Recent commit that might be a mistake | Low |\n| **Uncommitted Changes** | Files that need to be committed | Low |\n| **Wrong Branch Commit** | Commit that might belong on main/master | Medium |\n\n## Recovery Options\n\nEach disaster comes with multiple recovery strategies with different risk levels:\n\n- ✅ **Safe**: Can be easily undone (e.g., stash, soft reset)\n- ⚡ **Medium**: May require manual intervention (e.g., cherry-pick)\n- ⚠️ **High**: Destructive, cannot be undone (e.g., hard reset, clean)\n\n## How It Works\n\n1. **Analysis Phase**: `gitpanic` analyzes your git state using:\n   - `git reflog` to find recent operations\n   - `git status` to check for uncommitted changes\n   - `git log` to examine commit history\n\n2. **Detection Phase**: Multiple detectors scan for patterns:\n   - Recent commits (\u003c 2 minutes) → accidental commit?\n   - Detached HEAD state → need to reattach?\n   - Force push in reflog → overwritten commits?\n   - Branch deletion in reflog → can be recovered?\n   - MERGE_HEAD file → merge conflict?\n   - Untracked/modified files → need to commit?\n\n3. **Recovery Phase**: For each detected disaster, provide:\n   - Clear explanation of what happened\n   - Multiple recovery options with risk levels\n   - Step-by-step command preview\n   - Confirmation before execution\n\n## Examples\n\n### Recover a Deleted Branch\n\n```bash\n$ gitpanic\n⚠️  Found 1 potential issue:\n\n1. 🔴 Deleted Branch\n   Branch \"feature/login\" was deleted 45 seconds ago.\n   Confidence: 90%\n\nSelect an issue to fix [1-1]: 1\n\n🔧 Recovery options for: Deleted Branch\n\n1. ✅ Restore branch \"feature/login\"\n   Recreate the branch from the deleted commit\n   Risk: safe\n   Steps:\n   - git branch feature/login abc1234\n   - git checkout feature/login\n\nSelect a recovery option [1-1]: 1\n⚠️  Confirm: \"Restore branch \\\"feature/login\\\"\"? This can be undone. [y/N]: y\n\n✅ Recovery complete!\n```\n\n### Undo an Accidental Commit\n\n```bash\n$ gitpanic\n⚠️  Found 1 potential issue:\n\n1. 🟢 Accidental Commit\n   You just committed \"typo fix\" 12 seconds ago.\n   Confidence: 80%\n\nSelect an issue to fix [1-1]: 1\n\n🔧 Recovery options for: Accidental Commit\n\n1. ✅ Undo commit, keep changes staged\n   Remove the commit but keep your changes ready to commit\n   Risk: safe\n   Steps:\n   - git reset --soft HEAD~1\n\nSelect a recovery option [1-1]: 1\n⚠️  Confirm: \"Undo commit, keep changes staged\"? This can be undone. [y/N]: y\n\n✅ Recovery complete!\n```\n\n### Fix Detached HEAD\n\n```bash\n$ gitpanic\n⚠️  Found 1 potential issue:\n\n1. 🟡 Detached HEAD\n   You are in detached HEAD state. Changes here can be lost.\n   Confidence: 100%\n\nSelect an issue to fix [1-1]: 1\n\n🔧 Recovery options for: Detached HEAD\n\n1. ✅ Reattach to previous branch\n   Switch back to main\n   Risk: safe\n   Steps:\n   - git checkout main\n\nSelect a recovery option [1-1]: 1\n⚠️  Confirm: \"Reattach to previous branch\"? This can be undone. [y/N]: y\n\n✅ Recovery complete!\n```\n\n## Development\n\n```bash\n# Clone\ngit clone https://github.com/sulthonzh/gitpanic.git\ncd gitpanic\n\n# Install\nnpm install\n\n# Build\nnpm run build\n\n# Test\nnpm test\n\n# Run local\nnode dist/cli.js\n```\n\n## License\n\nMIT\n\n## Contributing\n\nContributions welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) first.\n\n## Similar Tools\n\n- [git-undo](https://github.com/zhangela/git-undo) - Python-based git undo\n- [ohshitgit.com](https://ohshitgit.com) - Reference site for git disasters\n- [git-reflog](https://git-scm.com/docs/git-reflog) - Raw git reflog reference\n\n**What makes gitpanic different?**\n- Interactive wizard UI (not just commands)\n- Auto-detects problems (no manual diagnosis needed)\n- TypeScript (modern, type-safe)\n- Recovery preview with risk levels\n- Safety-first with confirmations","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsulthonzh%2Fgitpanic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsulthonzh%2Fgitpanic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsulthonzh%2Fgitpanic/lists"}