gitbutlerapp/gitbutler · error

Branch "{name}" has no conflicted commits.

Error message

Branch "{name}" has no conflicted commits.

What it means

In target_conflicted_commit(), the user-supplied target parsed as a branch name via IdMap, but find_conflicted_commits() has no entry for that branch — no commit on it is currently conflicted. The error scopes conflict operations to branches that actually carry conflicts.

Source

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

/// Resolve `target` — a commit id, a CLI id, or a branch name (meaning that
/// branch's oldest conflicted commit) — or default to the oldest conflicted
/// commit of the first conflicted branch. `Ok(None)` means nothing is
/// conflicted.
fn target_conflicted_commit(
    ctx: &mut Context,
    target: Option<&str>,
) -> Result<Option<ConflictTarget>> {
    let conflicts_by_branch = find_conflicted_commits(ctx)?;
    let commit_oid = match target {
        // An exact conflicted-branch name scopes to that branch.
        Some(target) if conflicts_by_branch.contains_key(target) => {
            conflicts_by_branch[target][0].commit_oid
        }
        Some(target) => match parse_commit_or_branch(ctx, target)? {
            CommitOrBranch::Commit(commit_oid) => commit_oid,
            CommitOrBranch::Branch(name) => match conflicts_by_branch.get(&name) {
                Some(commits) => commits[0].commit_oid,
                None => bail!("Branch \"{name}\" has no conflicted commits."),
            },
        },
        None => match conflicts_by_branch.values().flatten().next() {
            Some(commit) => commit.commit_oid,
            None => return Ok(None),
        },
    };

    let branch = conflicts_by_branch
        .iter()
        .find(|(_, commits)| commits.iter().any(|commit| commit.commit_oid == commit_oid))
        .map(|(branch, _)| branch.clone());
    let other_conflicted = conflicts_by_branch
        .values()
        .flatten()
        .filter(|commit| commit.commit_oid != commit_oid)
        .map(|commit| commit.commit_oid)
        .collect::<HashSet<_>>()

View on GitHub (pinned to caf1f223d3)

Solutions

  1. Run `but resolve conflicts` with no target to list branches that currently have conflicted commits
  2. Use a commit id from that listing instead of the branch name
  3. If you expected this branch to be conflicted, re-run the update/rebase that creates the conflicts

Example fix

# before
but resolve conflicts feature-x
# error: Branch "feature-x" has no conflicted commits.

# after
but resolve conflicts          # auto-pick the first conflicted branch
but resolve conflicts other-br  # a branch that actually shows conflicts
Defensive patterns

Strategy: validation

Validate before calling

# restrict targets to branches that currently have conflicts
but resolve conflicts | awk '/branch/ {print $NF}' > /tmp/conflicted-branches.txt
grep -qx "feature-x" /tmp/conflicted-branches.txt && but resolve conflicts feature-x

Prevention

When it happens

Trigger: `but resolve conflicts <branch>`, `but resolve --ours <branch>` (or any command routed through target_conflicted_commit) with a valid branch name that has zero conflicted commits — because conflicts were resolved already, or the branch was never part of the conflicted rebase.

Common situations: Using a branch name whose conflicts were fixed in a previous session; case/spacing differences making it a different branch than the conflicted one; assuming every applied branch in the workspace is conflicted when only some are.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20). Data as JSON: /api/errors/7b5da197f858ce1f. Report an issue: GitHub.