gitbutlerapp/gitbutler · warning
There are changes that differ from the original commit you w
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
`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.
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 caf1f223d3)
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`
Example fix
# before but resolve cancel # error: There are changes that differ from the original commit... # after but resolve finish # keep changes # or but resolve cancel --force # deliberately drop changes
Defensive patterns
Strategy: try-catch
Validate before calling
# see whether edits exist relative to the edited commit but resolve status # inspect 'changes from initial' before canceling
Try / catch
but resolve cancel; rc=$? if [ $rc -ne 0 ] && ! grep -q 're-run with `--force`' err.log; then exit $rc # real failure, do not force fi # guard tripped: decide explicitly but resolve cancel --force || but resolve finish
Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Commit {commit_ref} is not in a conflicted state. Only confl
- Branch "{name}" has no conflicted commits.
- Failed to communicate with LM Studio server: ${error instanc
- Invalid response: ${JSON.stringify(result)}
- When using GitButler's API to summarize code, you must be lo
AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20).
Data as JSON: /api/errors/a4243f981ae46263.
Report an issue: GitHub.