{"record":{"id":"4819d4684d14c8ab","repo":"gitbutlerapp/gitbutler","slug":"destination-commit-must-not-be-conflicted","errorCode":null,"errorMessage":"Destination commit must not be conflicted","messagePattern":"Destination commit must not be conflicted","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-workspace/src/commit/move_changes.rs","lineNumber":99,"sourceCode":"    if !dropped_diffs.is_empty() {\n        bail!(\"Failed to extract described changes from source commit\");\n    }\n\n    let new_source_commit_id = {\n        let mut new_source_commit = source_commit.clone();\n        new_source_commit.tree = source_tree_without_changes_id;\n        editor.new_commit(new_source_commit, DateMode::CommitterUpdateAuthorKeep)?\n    };\n\n    editor.replace(source_selector, Step::new_pick(new_source_commit_id))?;\n\n    // Rebase and get potentially rebased destination commit\n    let mut editor = editor.rebase()?.into_editor();\n    let (_, rebased_destination_commit) = editor.find_selectable_commit(destination_selector)?;\n    let destination_tree_id = {\n        let rebased_destination_commit = rebased_destination_commit.clone().attach(editor.repo());\n        if rebased_destination_commit.is_conflicted() {\n            bail!(\"Destination commit must not be conflicted\")\n        }\n        rebased_destination_commit.tree\n    };\n\n    let destination_tree_with_changes = {\n        let repo = editor.repo();\n        let (fail_fast_options, conflict_kind) = repo.merge_options_fail_fast()?;\n        let mut merge_result = repo.merge_trees(\n            source_tree_without_changes_id,\n            source_tree_id,\n            destination_tree_id,\n            Default::default(),\n            fail_fast_options,\n        )?;\n\n        if merge_result.has_unresolved_conflicts(conflict_kind) {\n            bail!(\"Failed to apply changes to destination commit - merge conflict\");\n        }","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-workspace/src/commit/move_changes.rs#L81-L117","documentation":"Guard in move_changes_between_commits: the destination commit currently carries conflicts, so moving changes into it would compound an unresolved state. The operation is refused until the user resolves the destination commit's conflicts, after which the move can be retried.","triggerScenarios":"move_changes_between_commits finds the (rebased) destination commit conflicted via is_conflicted() before applying the changes to its tree.","commonSituations":"Moving changes into a commit that sits behind a conflict introduced by a rebase; destination commit already carried conflict markers from a prior operation.","solutions":["Resolve conflicts in the destination commit before moving changes into it","Choose a non-conflicted destination commit","Re-run the rebase resolving conflicts, then retry the move"],"exampleFix":"// before\neditor.move_changes_between_commits(src, conflicted_dst, changes, ctx)?;\n// after\nresolve_conflicts_in(conflicted_dst)?;\neditor.move_changes_between_commits(src, conflicted_dst, changes, ctx)?;","handlingStrategy":"validation","validationCode":"let (_, dst) = editor.find_selectable_commit(dest_selector)?;\nif dst.clone().attach(editor.repo()).is_conflicted() {\n    bail!(\"resolve destination conflicts first\");\n}","typeGuard":"fn moveable(commit: &gix::Commit) -> bool { !commit.clone().attach(commit.repo).is_conflicted() }","tryCatchPattern":"match editor.move_changes_between_commits(src, dst, changes, ctx) {\n    Err(e) if e.to_string().contains(\"Destination commit must not be conflicted\") => resolve_then_retry(dst),\n    other => other,\n}","preventionTips":["Check destination conflict state (pre- and post-rebase) before moves","Resolve conflicts before pulling changes into a commit","Prefer conflict-free destinations when automating moves"],"tags":["git","conflict","move","precondition"],"backgroundTag":"invalid-state-transition","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}