gitbutlerapp/gitbutler · warning

No diffs to show.

Error message

No diffs to show.

What it means

`but diff` opens the TUI diff viewer for a chosen target: a file inside a commit, a whole commit, a branch/lane, or (by default) the worktree. After `DiffFileEntry::from_commit`/`from_branch`/`from_worktree` collects the changed files, an empty list means there is nothing to render, so the command bails instead of launching an empty viewer.

Source

Thrown at crates/but/src/command/legacy/diff/mod.rs:63

            CliId::CommittedFile {
                committed_file:
                    CommittedFileId {
                        commit_id, path, ..
                    },
                id: _,
            } => DiffFileEntry::from_commit(ctx, commit_id, Some(path))?,
            CliId::Commit {
                commit: CommitId { commit_id, .. },
                id: _,
            } => DiffFileEntry::from_commit(ctx, commit_id, None)?,
            CliId::Branch(branch) => DiffFileEntry::from_branch(ctx, branch.name)?,
        }
    } else {
        DiffFileEntry::from_worktree(&id_map, None)
    };

    if files.is_empty() {
        anyhow::bail!("No diffs to show.");
    }

    crate::tui::diff_viewer::run_diff_viewer(files)
}

pub fn handle(
    ctx: &mut Context,
    out: &mut OutputChannel,
    target_str: Option<&str>,
) -> anyhow::Result<()> {
    let id_map = IdMap::legacy_new_from_context(ctx)?;

    if let Some(entity) = target_str {
        let id = id_map
            .parse_using_context(entity, ctx)? // TODO: look up plain names
            .first() // TODO: handle ambiguity
            .cloned()
            .ok_or_else(|| anyhow::anyhow!("No ID found for entity"))?;

View on GitHub (pinned to caf1f223d3)

Solutions

  1. Run `but status` and confirm uncommitted changes exist before a bare `but diff`.
  2. Pick a target that actually changed files, e.g. `but diff <commit-id>` for a content-changing commit.
  3. If you expected worktree changes, verify with `git status` that the worktree is not clean.

Example fix

# before
but diff          # clean worktree -> No diffs to show.

# after
but diff 3k       # open the diff of a commit that changed files
Defensive patterns

Strategy: validation

Validate before calling

# Only open the viewer when the worktree actually has changes
[ -n "$(git status --porcelain)" ] && but diff || echo 'nothing to diff'

Prevention

When it happens

Trigger: `but diff` with no argument on a clean worktree; `but diff <commit-id>` where the commit's diff is empty (empty/revert-style commit with no net changes); `but diff <branch-id>` for a lane with no diff against the base; `but diff <commit-id> <path>` where that commit did not touch the path.

Common situations: Running the viewer right after committing or absorbing everything; selecting a commit whose changes are identical to its parent; assuming a file was changed by a commit when it was not.

Related errors


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