@@ -978,6 +978,11 @@ fn restack(
978978) -> Result < ( ) , anyhow:: Error > {
979979 let restack_branch = restack_branch. unwrap_or ( orig_branch. clone ( ) ) ;
980980
981+ // Track what changes occurred during restack
982+ let mut branches_created: Vec < String > = Vec :: new ( ) ;
983+ let mut branches_restacked: Vec < String > = Vec :: new ( ) ;
984+ let mut branches_pushed: Vec < String > = Vec :: new ( ) ;
985+
981986 if fetch {
982987 git_fetch ( ) ?;
983988 }
@@ -987,10 +992,7 @@ fn restack(
987992 let remote_ref = format ! ( "{DEFAULT_REMOTE}/{restack_branch}" ) ;
988993 if git_repo. ref_exists ( & remote_ref) {
989994 run_git ( & [ "checkout" , "-b" , & restack_branch, & remote_ref] ) ?;
990- println ! (
991- "Created local branch {} from remote." ,
992- restack_branch. yellow( )
993- ) ;
995+ branches_created. push ( restack_branch. clone ( ) ) ;
994996 } else {
995997 bail ! (
996998 "Branch {} does not exist locally or on remote." ,
@@ -1025,7 +1027,6 @@ fn restack(
10251027 if push
10261028 && !git_repo. shas_match ( & format ! ( "{DEFAULT_REMOTE}/{}" , branch. name) , & branch. name )
10271029 {
1028- println ! ( "Pushing branch '{}' to remote..." , branch. name) ;
10291030 run_git ( & [
10301031 "push" ,
10311032 match branch. stack_method {
@@ -1042,6 +1043,7 @@ fn restack(
10421043 & format ! ( "{branch_name}:{branch_name}" , branch_name = branch. name) ,
10431044 ] ) ?;
10441045 pushed_branches. push ( branch. name . clone ( ) ) ;
1046+ branches_pushed. push ( branch. name . clone ( ) ) ;
10451047 }
10461048 } else {
10471049 tracing:: info!( "Branch '{}' is not stacked on '{}'..." , branch. name, parent) ;
@@ -1080,9 +1082,11 @@ fn restack(
10801082 ) ;
10811083 std:: process:: exit ( 1 ) ;
10821084 }
1085+ branches_restacked. push ( branch. name . clone ( ) ) ;
10831086 if push {
10841087 git_push ( git_repo, & branch. name ) ?;
10851088 pushed_branches. push ( branch. name . clone ( ) ) ;
1089+ branches_pushed. push ( branch. name . clone ( ) ) ;
10861090 }
10871091 continue ;
10881092 }
@@ -1101,9 +1105,11 @@ fn restack(
11011105 ) ;
11021106 std:: process:: exit ( 1 ) ;
11031107 }
1108+ branches_restacked. push ( branch. name . clone ( ) ) ;
11041109 if push {
11051110 git_push ( git_repo, & branch. name ) ?;
11061111 pushed_branches. push ( branch. name . clone ( ) ) ;
1112+ branches_pushed. push ( branch. name . clone ( ) ) ;
11071113 }
11081114 tracing:: info!( "Rebase completed successfully. Continuing..." ) ;
11091115 }
@@ -1112,6 +1118,7 @@ fn restack(
11121118 . with_context ( || format ! ( "checking out {}" , branch. name) ) ?;
11131119 run_git ( & [ "merge" , & parent] )
11141120 . with_context ( || format ! ( "merging {parent} into {}" , branch. name) ) ?;
1121+ branches_restacked. push ( branch. name . clone ( ) ) ;
11151122 }
11161123 }
11171124 }
@@ -1130,7 +1137,46 @@ fn restack(
11301137 "git checkout {} failed" ,
11311138 restack_branch
11321139 ) ;
1133- println ! ( "Done." ) ;
1140+
1141+ // Print summary report if any changes occurred
1142+ let has_changes = !branches_created. is_empty ( )
1143+ || !branches_restacked. is_empty ( )
1144+ || !branches_pushed. is_empty ( ) ;
1145+
1146+ if has_changes {
1147+ println ! ( ) ;
1148+ if !branches_created. is_empty ( ) {
1149+ println ! (
1150+ "Created from remote: {}" ,
1151+ branches_created
1152+ . iter( )
1153+ . map( |b| b. yellow( ) . to_string( ) )
1154+ . collect:: <Vec <_>>( )
1155+ . join( ", " )
1156+ ) ;
1157+ }
1158+ if !branches_restacked. is_empty ( ) {
1159+ println ! (
1160+ "Restacked: {}" ,
1161+ branches_restacked
1162+ . iter( )
1163+ . map( |b| b. yellow( ) . to_string( ) )
1164+ . collect:: <Vec <_>>( )
1165+ . join( ", " )
1166+ ) ;
1167+ }
1168+ if !branches_pushed. is_empty ( ) {
1169+ println ! (
1170+ "Pushed: {}" ,
1171+ branches_pushed
1172+ . iter( )
1173+ . map( |b| b. yellow( ) . to_string( ) )
1174+ . collect:: <Vec <_>>( )
1175+ . join( ", " )
1176+ ) ;
1177+ }
1178+ }
1179+
11341180 state. refresh_lkgs ( git_repo, repo) ?;
11351181
11361182 // Note: PR sync is now handled separately via `git stack sync`
0 commit comments