{"record":{"id":"387a3d96e81a4df9","repo":"GitoxideLabs/gitoxide","slug":"the-current-checkout-has-a-pending-rebase-time-tr","errorCode":null,"errorMessage":"the current checkout has a pending rebase; time-travel to HEAD before editing it","messagePattern":"the current checkout has a pending rebase; time-travel to HEAD before editing it","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-tix/src/edit/rebase.rs","lineNumber":2571,"sourceCode":"            }\n        }\n    }\n    if repeat\n        && let Some(base) = affected.first()\n        && let Some(parent) = graph.parents_of(*base).and_then(|parents| parents.first().copied())\n        && is_pending(&repo.find_commit(parent)?.decode()?.into_owned()?)\n    {\n        anyhow::bail!(\"the parent of a repeated rebase must not be pending\");\n    }\n    Ok(())\n}\n\nfn reject_pending_checkout_path(repo: &gix::Repository, mut id: ObjectId) -> Result<()> {\n    let mut seen = HashSet::new();\n    while seen.insert(id) {\n        let commit = repo.find_commit(id)?.decode()?.into_owned()?;\n        if is_pending(&commit) {\n            anyhow::bail!(\"the current checkout has a pending rebase; time-travel to HEAD before editing it\");\n        }\n        let Some(parent) = commit.parents.first().copied() else {\n            break;\n        };\n        id = parent;\n    }\n    Ok(())\n}\n\nenum TreeRewrite {\n    Complete(ObjectId),\n    Conflict {\n        ours: ObjectId,\n        merged: ObjectId,\n        conflicts: Vec<gix::merge::tree::Conflict>,\n    },\n}\n","sourceCodeStart":2553,"sourceCodeEnd":2589,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/edit/rebase.rs#L2553-L2589","documentation":"`reject_pending_checkout_path` walks from a commit id up its first-parent chain and fails if any ancestor is a pending rebase commit. The currently checked-out history contains an unfinished (pending) rebase; editing it requires first time-traveling back to HEAD, otherwise the edit would operate on provisional rebase state.","triggerScenarios":"Any edit operation that resolves a checkout path via `reject_pending_checkout_path` when walking `commit.parents.first()` reaches a commit for which `is_pending()` is true — i.e. the commit chain being edited includes a pending rebase commit reachable from the current checkout.","commonSituations":"User is in the middle of an interactive rebase (detached pending commits exist) and tries to run an edit/undo/rewrite command against an ancestor; automation scripts invoked while a rebase is paused mid-conflict.","solutions":["Time-travel back to HEAD (abandon/complete the pending rebase checkout) before running the edit, as the message instructs.","Complete the in-progress rebase (resolve conflicts and continue) then retry the edit.","Abort the pending rebase, then re-run the edit operation.","Pick a different target commit that is not on a pending rebase path."],"exampleFix":"// before: editing while a pending rebase is checked out\nedit.perform(repo, target_id)?; // bails\n// after: return to HEAD first\ntime_travel_to_head(repo)?; // restore checkout to HEAD\nedit.perform(repo, target_id)?;","handlingStrategy":"validation","validationCode":"// walk first-parent chain from the edit target before editing\nlet mut id = target_id;\nlet mut seen = std::collections::HashSet::new();\nwhile seen.insert(id) {\n    let c = repo.find_commit(id)?.decode()?.into_owned()?;\n    if gix_tix::edit::rebase::is_pending(&c) { time_travel_to_head(repo)?; break; }\n    match c.parents.first().copied() { Some(p) => id = p, None => break }\n}\n","typeGuard":null,"tryCatchPattern":"match edit::perform(repo, target_id) {\n    Err(e) if e.to_string().contains(\"pending rebase\") => {\n        time_travel_to_head(repo)?;\n        edit::perform(repo, target_id)\n    }\n    other => other,\n}\n","preventionTips":["Finish or abort in-progress rebases before running edit tooling","Restore checkout to HEAD before scripted edits","Avoid running edits from detached/pending rebase checkouts"],"tags":["rebase","git","checkout","state-validation"],"backgroundTag":"invalid-state-transition","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}