{
  "id": "git/commit-not-ancestor-rebase",
  "signature": "fatal: <commit-hash> is not an ancestor of HEAD",
  "signature_zh": "致命：<提交哈希> 不是 HEAD 的祖先",
  "regex": "fatal: [a-f0-9]+ is not an ancestor of HEAD",
  "domain": "git",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Attempting to rebase onto a commit that is not reachable from the current branch's history, violating the rebase precondition that the upstream commit must be an ancestor.",
  "root_cause_type": "generic",
  "root_cause_zh": "尝试变基到一个从当前分支历史无法到达的提交，违反了变基的前提条件，即上游提交必须是祖先。",
  "versions": [
    {
      "version": "git 2.40.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "git 2.41.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "git 2.42.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The --onto option expects a valid upstream; using an unrelated commit still fails the ancestor check or creates a broken history.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Fetching updates remote refs but does not change the local branch's ancestry; the error persists unless the branch is reset or merged.",
      "fail_rate": 0.55,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use 'git log --oneline --graph' to inspect the commit graph and ensure the target commit is reachable, then rebase onto a correct ancestor like 'git rebase --onto <target> <old-base>'",
      "success_rate": 0.85,
      "how": "Use 'git log --oneline --graph' to inspect the commit graph and ensure the target commit is reachable, then rebase onto a correct ancestor like 'git rebase --onto <target> <old-base>'",
      "condition": "",
      "sources": []
    },
    {
      "action": "If the commit is in another branch, merge that branch first with 'git merge <other-branch>' to make the commit an ancestor, then rebase",
      "success_rate": 0.8,
      "how": "If the commit is in another branch, merge that branch first with 'git merge <other-branch>' to make the commit an ancestor, then rebase",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Use 'git log --oneline --graph' to inspect the commit graph and ensure the target commit is reachable, then rebase onto a correct ancestor like 'git rebase --onto <target> <old-base>'",
    "If the commit is in another branch, merge that branch first with 'git merge <other-branch>' to make the commit an ancestor, then rebase"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://git-scm.com/docs/git-rebase#Documentation/git-rebase.txt---onto",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.8,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2024-01-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}