nikivdev/code · error

Rebase conflict - manual resolution required

Error message

Rebase conflict - manual resolution required

What it means

This library wraps `git rebase` during a push/commit workflow. When the rebase stops due to merge conflicts, it detects the conflicted state and fails fast with this error instead of silently continuing. It is intentional: the conflict requires human resolution, and the library prints the exact steps to finish (fix files, git add, git rebase --continue, git push) or abort.

Source

Thrown at src/commit.rs:2164

                        println!("done");
                        print!("Pushing... ");
                        io::stdout().flush()?;
                        git_push_run(&push_remote, &push_branch)?;
                        println!("done");
                        info!("pulled and pushed to remote");
                        pushed = true;
                    }
                    Err(_) => {
                        println!("conflict!");
                        println!();
                        println!("Rebase conflict detected. Resolve manually:");
                        println!("  1. Fix conflicts in the listed files");
                        println!("  2. git add <files>");
                        println!("  3. git rebase --continue");
                        println!("  4. git push");
                        println!();
                        println!("Or abort with: git rebase --abort");
                        bail!("Rebase conflict - manual resolution required");
                    }
                }
            }
        }
    }

    // Record undo action
    record_undo_action(&repo_root, pushed, Some(&message));

    // Sync mirrors with AI sessions since previous checkpoint.
    let cwd = std::env::current_dir().unwrap_or_default();
    let sync_gitedit = gitedit_globally_enabled() && gitedit_mirror_enabled_for_commit(&repo_root);
    let sync_myflow = myflow_mirror_enabled(&repo_root);
    let (sync_sessions, sync_window) = if sync_gitedit || sync_myflow {
        let (sessions, window) = collect_sync_sessions_for_commit_with_window(&repo_root);
        (sessions, Some(window))
    } else {
        (Vec::new(), None)

View on GitHub (pinned to a747e741ae)

Solutions

  1. Run `git status` to list conflicted files, edit them to resolve conflict markers, then `git add <files>`.
  2. Run `git rebase --continue` (repeat resolve/continue for each conflicted commit), then push.
  3. If the rebase is undesired, run `git rebase --abort` to return to the pre-rebase state.
  4. Prevent recurrence by rebasing regularly (`git fetch && git rebase origin/main`) so conflicts stay small.

Example fix

// before: pushing a stale branch that fails mid-rebase
// $ rebase conflict in src/main.rs
<<<<<<< HEAD
let x = upstream_value();
=======
let x = my_value();
>>>>>>> my-branch
// after: resolve markers, keep correct code, stage and continue
let x = merged_value();
// $ git add src/main.rs && git rebase --continue && git push
Defensive patterns

Strategy: validation

Validate before calling

// Before invoking the flow, check for a dirty rebase/conflict state
let out = Command::new("git").args(["status", "--porcelain"]).output()?;
let conflicted = String::from_utf8_lossy(&out.stdout)
    .lines()
    .any(|l| l.starts_with("UU") || l.starts_with("AA") || l.starts_with("DD"));
if conflicted { /* resolve or abort rebase first */ }

Prevention

When it happens

Trigger: Calling the commit/push flow (which runs an internal `git rebase` before push) when the upstream branch has commits that conflict with local commits; `git rebase` exits non-zero with unmerged paths in the worktree.

Common situations: Pulling changes from teammates whose edits overlap yours on the same lines; long-lived feature branches behind main; cherry-picked or reordered commits colliding with upstream changes.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/9507937fc25f010c. Report an issue: GitHub.