{"record":{"id":"a4243f981ae46263","repo":"gitbutlerapp/gitbutler","slug":"there-are-changes-that-differ-from-the-original-co","errorCode":null,"errorMessage":"There are changes that differ from the original commit you were editing. Canceling will drop those changes.\n\nIf you want to go through with this, please re-run with `--force`.\n\nIf you want to keep the changes you have made, consider finishing the resolution and then moving the changes with `but squash`.","messagePattern":"There are changes that differ from the original commit you were editing\\. Canceling will drop those changes\\.\n\nIf you want to go through with this, please re-run with `--force`\\.\n\nIf you want to keep the changes you have made, consider finishing the resolution and then moving the changes with `but squash`\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/but/src/command/legacy/resolve.rs","lineNumber":619,"sourceCode":"        .collect();\n    paths.sort();\n    Ok(paths)\n}\n\nfn cancel_resolution(ctx: &mut Context, out: &mut OutputChannel, force: bool) -> Result<()> {\n    let t = theme::get();\n    // Check if we're in edit mode\n    let mode = operating_mode(ctx)?.operating_mode;\n    if !matches!(mode, OperatingMode::Edit(_)) {\n        // Not in edit mode, show the workflow help instead\n        return show_workflow_help(out);\n    }\n\n    if !force && {\n        let guard = ctx.shared_worktree_access();\n        !changes_from_initial(ctx, guard.read_permission())?.is_empty()\n    } {\n        bail!(\n            \"There are changes that differ from the original commit you were editing. Canceling will drop those changes.\\n\\nIf you want to go through with this, please re-run with `--force`.\\n\\nIf you want to keep the changes you have made, consider finishing the resolution and then moving the changes with `but squash`.\"\n        )\n    }\n\n    // Abort and return to workspace\n    abort_edit_and_return_to_workspace(ctx, force)\n        .context(\"Failed to cancel resolution and return to workspace\")?;\n\n    if let Some(out) = out.for_human() {\n        writeln!(\n            out,\n            \"{}\",\n            t.attention.paint(\"Conflict resolution cancelled.\")\n        )?;\n        writeln!(\n            out,\n            \"All changes made during resolution have been discarded.\"\n        )?;","sourceCodeStart":601,"sourceCodeEnd":637,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/legacy/resolve.rs#L601-L637","documentation":"`but resolve cancel` refuses to abort edit mode when changes_from_initial() reports edits relative to the commit being edited, unless --force is passed. It is a destructive-action guard: canceling would silently drop the user's resolutions/edits.","triggerScenarios":"Running `but resolve cancel` (no --force) while in edit mode with uncommitted modifications relative to the initial commit — e.g. you edited files or accepted hunks inside resolution mode, then changed your mind about canceling.","commonSituations":"Long resolution session with manual edits; scripting `but resolve cancel` in automation that hits a workspace left half-eded; muscle-memory cancel after partially fixing conflicts.","solutions":["Run `but resolve finish` if you want to keep the changes — that is the non-destructive exit","Run `but resolve cancel --force` if you really want to drop the edits","To move the edits elsewhere instead: finish the resolution, then relocate them with `but squash`"],"exampleFix":"# before\nbut resolve cancel\n# error: There are changes that differ from the original commit...\n\n# after\nbut resolve finish        # keep changes\n# or\nbut resolve cancel --force  # deliberately drop changes","handlingStrategy":"try-catch","validationCode":"# see whether edits exist relative to the edited commit\nbut resolve status   # inspect 'changes from initial' before canceling","typeGuard":null,"tryCatchPattern":"but resolve cancel; rc=$?\nif [ $rc -ne 0 ] && ! grep -q 're-run with `--force`' err.log; then\n  exit $rc  # real failure, do not force\nfi\n# guard tripped: decide explicitly\nbut resolve cancel --force || but resolve finish","preventionTips":["Prefer `but resolve finish` as the default exit; cancel only to discard","Never script blind `--force`; branch on the guard message","Snapshot uncommitted edits (git stash / copy worktree) before force-canceling"],"tags":["gitbutler","conflict-resolution","destructive-guard","cli-flags"],"backgroundTag":"destructive-operation-guard","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}