diff --git a/frontend/src/pages/task-attempt-compare.tsx b/frontend/src/pages/task-attempt-compare.tsx
index fc9693c5..4332f980 100644
--- a/frontend/src/pages/task-attempt-compare.tsx
+++ b/frontend/src/pages/task-attempt-compare.tsx
@@ -601,19 +601,19 @@ export function TaskAttemptComparePage() {
{branchStatus.up_to_date ? (
Up to date
- ) : branchStatus.is_behind === true ? (
+ ) : branchStatus.is_behind === true && !branchStatus.merged ? (
{branchStatus.commits_behind} commit
{branchStatus.commits_behind !== 1 ? 's' : ''} behind{' '}
{branchStatus.base_branch_name}
- ) : (
+ ) : !branchStatus.merged ? (
{branchStatus.commits_ahead} commit
{branchStatus.commits_ahead !== 1 ? 's' : ''} ahead of{' '}
{branchStatus.base_branch_name}
- )}
+ ) : null}
{branchStatus.has_uncommitted_changes && (