@@ -67,6 +67,10 @@ pub(crate) fn worktree(repo_path: &Path, json: bool, show_base: bool, show_files
67
67
// Print branches with commits and assigned files
68
68
if !stacks. is_empty ( ) {
69
69
print_branch_sections ( & stacks, & assignments_by_file, & changes, & project, show_files, ctx) ?;
70
+
71
+ // Print legend for commit status decorations
72
+ println ! ( "Legend: {} Remote-only {} Pushed {} Local-only" ,
73
+ "R" . red( ) , "P" . yellow( ) , "L" . green( ) ) ;
70
74
}
71
75
72
76
// Print unassigned files
@@ -360,9 +364,19 @@ fn print_branch_sections(
360
364
let commit_short = & commit. id . to_string ( ) [ ..7 ] ;
361
365
let commit_id = CliId :: commit ( commit. id ) . to_string ( ) . underline ( ) . blue ( ) ;
362
366
let message_line = format_commit_message ( & commit. message ) ;
367
+
368
+ // Check if this upstream commit also exists in local commits (pushed)
369
+ let is_also_local = branch. commits . iter ( ) . any ( |local| local. id == commit. id ) ;
370
+ let status_decoration = if is_also_local {
371
+ "P" . yellow ( ) // Pushed (exists both upstream and locally)
372
+ } else {
373
+ "R" . red ( ) // Remote-only (upstream only)
374
+ } ;
375
+
363
376
println ! (
364
- "{}● {} {} {}" ,
377
+ "{}● {} {} {} {}" ,
365
378
prefix,
379
+ status_decoration,
366
380
commit_id,
367
381
commit_short. blue( ) ,
368
382
message_line
@@ -392,14 +406,25 @@ fn print_branch_sections(
392
406
}
393
407
}
394
408
395
- // Show local commits
409
+ // Show local commits (but skip ones already shown as upstream)
396
410
for commit in & branch. commits {
411
+ // Skip if this commit was already shown in upstream commits
412
+ let already_shown = branch. upstream_commits . iter ( ) . any ( |upstream| upstream. id == commit. id ) ;
413
+ if already_shown {
414
+ continue ;
415
+ }
416
+
397
417
let commit_short = & commit. id . to_string ( ) [ ..7 ] ;
398
418
let commit_id = CliId :: commit ( commit. id ) . to_string ( ) . underline ( ) . blue ( ) ;
399
419
let message_line = format_commit_message ( & commit. message ) ;
420
+
421
+ // Local-only commits (not pushed)
422
+ let status_decoration = "L" . green ( ) ;
423
+
400
424
println ! (
401
- "{}● {} {} {}" ,
425
+ "{}● {} {} {} {}" ,
402
426
prefix,
427
+ status_decoration,
403
428
commit_id,
404
429
commit_short. blue( ) ,
405
430
message_line
0 commit comments