{"record":{"id":"dde963517e0b2bfc","repo":"GitoxideLabs/gitoxide","slug":"cannot-amend-with-unresolved-index-conflicts","errorCode":null,"errorMessage":"cannot amend with unresolved index conflicts","messagePattern":"cannot amend with unresolved index conflicts","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-tix/src/edit/head.rs","lineNumber":106,"sourceCode":"        (Kind::Amend, Some(([path], _))) => Some(path),\n        (Kind::Amend, Some(_)) => anyhow::bail!(\"amending requires exactly one selected path\"),\n        _ => None,\n    };\n    let tree = match kind {\n        Kind::Spill => match selected_paths {\n            Some((paths, selected_parent)) => {\n                spill_paths_tree(&repo, old_tree, selected_parent.unwrap_or(parent_tree), paths)?\n            }\n            None => parent_tree,\n        },\n        Kind::Amend => {\n            let index = repo.index_or_empty().context(\"could not load the index\")?;\n            if index\n                .entries()\n                .iter()\n                .any(|entry| entry.stage() != gix::index::entry::Stage::Unconflicted)\n            {\n                anyhow::bail!(\"cannot amend with unresolved index conflicts\");\n            }\n            if let Some(path) = selected_amend_path {\n                if review && path.group != crate::ChangeGroup::Staged {\n                    anyhow::bail!(\"review commits can amend only staged paths\");\n                }\n                amend_path_tree(&repo, old_tree, path, &index)?\n            } else if review || index_only {\n                let index_tree = create::index_tree(&repo, &index)?;\n                if index_tree == old_tree && !pending {\n                    return Ok(None);\n                }\n                index_tree\n            } else {\n                let index_tree = create::index_tree(&repo, &index)?;\n                if index_tree != old_tree {\n                    index_tree\n                } else {\n                    let baseline = repo.find_tree(old_tree)?;","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/edit/head.rs#L88-L124","documentation":"When amending the head commit, tix loads the index and rejects the operation if any index entry is at a non-Unconflicted stage, i.e. there are unresolved merge conflicts. Committing an amend from a conflicted index would produce a broken commit, so it fails fast.","triggerScenarios":"`perform_inner` (reached via `perform`, `perform_with_changes`, `perform_reporting`, `amend_index`, `amend_index_reporting`) runs while the index contains conflict stages — mid-merge/rebase with unresolved paths.","commonSituations":"Issuing a `tix` amend right after a conflicted merge; resuming scripted edits after an interrupted rebase; forgetting that `git add` was never run on resolved files.","solutions":["Resolve all conflicts and stage them (`git add <paths>`) before amending.","Abort the in-progress merge/rebase and redo the operation on a clean state.","Verify with `git status` (no 'Unmerged paths') that the index is conflict-free first."],"exampleFix":"// guard before amend\nlet index = repo.index_or_empty()?;\nif index.entries().iter().any(|e| e.stage() != gix::index::entry::Stage::Unconflicted) {\n    anyhow::bail!(\"resolve index conflicts first\");\n}\nhead::perform(&repo, Kind::Amend, None, ...)?;","handlingStrategy":"validation","validationCode":"let index = repo.index_or_empty()?;\nlet conflicted = index.entries().iter()\n    .any(|e| e.stage() != gix::index::entry::Stage::Unconflicted);\nif conflicted {\n    anyhow::bail!(\"cannot amend: resolve index conflicts first\");\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"cannot amend with unresolved index conflicts\") => {\n        eprintln!(\"resolve conflicts and stage them, then amend again\");\n    }\n    other => other?,\n}","preventionTips":["Only amend on a conflict-free index; check `git status` first.","Finish or abort in-progress merges/rebases before edit operations.","Add an index-conflict assertion to any automation calling amend."],"tags":["git","merge-conflict","amend"],"backgroundTag":"unresolved-index-conflict","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"}