gitbutlerapp/gitbutler · warning

There are changes that differ from the original commit you…

Error message

There are changes that differ from the original commit you were editing. Canceling will drop those changes.

If you want to go through with this, please re-run with `--force`.

If you want to keep the changes you have made, consider finishing the resolution and then moving the changes with `but squash`.

What it means

This error is thrown by `but resolve cancel` when canceling an edit/resolution session would discard work: the worktree currently differs from the state captured when the session started (changes_from_initial is non-empty) and `--force` was not passed. It protects the user from silently losing conflict-resolution edits. The message also points to `but squash` as the way to preserve the changes.

Solutions

  1. Review the changes; if discarding is intended, re-run with `but resolve cancel --force`.
  2. If the edits should be kept, finish the resolution and move them with `but squash` as the message suggests.
  3. Inspect the worktree (git diff / but status) to decide whether to force or keep.

Example fix

// before
but resolve cancel
// after
but resolve cancel --force
Defensive patterns

Strategy: validation

Validate before calling

const initial = captureWorktreeState(); // at session start
function canCancelSafely() { return diff(initial, captureWorktreeState()).length === 0; }
if (!canCancelSafely()) { confirm('Canceling will drop changes; use --force to proceed'); }

Prevention

When it happens

Trigger: Running `but resolve cancel` (cancel_resolution) after having modified the conflicted files or otherwise changed the worktree during the resolution session, without the `--force` flag.

Common situations: A developer enters conflict resolution, makes some manual edits, then decides to abort with `but resolve cancel`; the CLI refuses because those edits would be dropped.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/a4243f981ae46263. Report an issue: GitHub.

Appendix: source

Thrown at crates/but/src/command/legacy/resolve.rs:619

        .collect();
    paths.sort();
    Ok(paths)
}

fn cancel_resolution(ctx: &mut Context, out: &mut OutputChannel, force: bool) -> Result<()> {
    let t = theme::get();
    // Check if we're in edit mode
    let mode = operating_mode(ctx)?.operating_mode;
    if !matches!(mode, OperatingMode::Edit(_)) {
        // Not in edit mode, show the workflow help instead
        return show_workflow_help(out);
    }

    if !force && {
        let guard = ctx.shared_worktree_access();
        !changes_from_initial(ctx, guard.read_permission())?.is_empty()
    } {
        bail!(
            "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`."
        )
    }

    // Abort and return to workspace
    abort_edit_and_return_to_workspace(ctx, force)
        .context("Failed to cancel resolution and return to workspace")?;

    if let Some(out) = out.for_human() {
        writeln!(
            out,
            "{}",
            t.attention.paint("Conflict resolution cancelled.")
        )?;
        writeln!(
            out,
            "All changes made during resolution have been discarded."
        )?;

View on GitHub (pinned to 58e5313667)