-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: rename cascade command to restack, keep cascade as alias #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,6 +4,7 @@ package cmd | |||||||||||||||||||||||
| import ( | ||||||||||||||||||||||||
| "fmt" | ||||||||||||||||||||||||
| "os" | ||||||||||||||||||||||||
| "strings" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| "github.com/boneskull/gh-stack/internal/git" | ||||||||||||||||||||||||
| "github.com/boneskull/gh-stack/internal/state" | ||||||||||||||||||||||||
|
|
@@ -13,8 +14,8 @@ import ( | |||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| var abortCmd = &cobra.Command{ | ||||||||||||||||||||||||
| Use: "abort", | ||||||||||||||||||||||||
| Short: "Abort a cascade in progress", | ||||||||||||||||||||||||
| Long: `Abort a cascade operation and restore the original state.`, | ||||||||||||||||||||||||
| Short: "Abort an operation in progress", | ||||||||||||||||||||||||
| Long: `Abort a restack or submit operation and restore the original state.`, | ||||||||||||||||||||||||
|
Comment on lines
+17
to
+18
|
||||||||||||||||||||||||
| Short: "Abort an operation in progress", | |
| Long: `Abort a restack or submit operation and restore the original state.`, | |
| Short: "Abort a restack or submit operation in progress", | |
| Long: `Abort a restack or submit operation in progress. | |
| This stops the current operation, aborts any in-progress rebase, cleans up | |
| internal state, and restores any auto-stashed local changes. | |
| It does not roll back branches that were already successfully rebased or | |
| otherwise modified earlier in the operation. For a full rollback of changes | |
| made by a restack or submit, use "gh stack undo".`, |
Copilot
AI
Feb 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abort prints the operation name based on st.Operation, but restack (and sync's restack phase) store OperationCascade ("cascade") in the state file. This means aborting a gh stack restack run will currently print “Cascade aborted…”, which conflicts with the renamed command. Consider mapping "cascade" to the display name "restack" (while still keeping "submit" as-is), or deriving the display name from the command invoked rather than the internal operation key.
| opName = "Operation" | |
| } | |
| fmt.Printf("%s %s aborted. Original HEAD was %s\n", s.WarningIcon(), strings.ToUpper(opName[:1])+opName[1:], st.OriginalHead) | |
| opName = "operation" | |
| } | |
| if opName == state.OperationCascade { | |
| opName = "restack" | |
| } | |
| displayName := strings.ToUpper(opName[:1]) + opName[1:] | |
| fmt.Printf("%s %s aborted. Original HEAD was %s\n", s.WarningIcon(), displayName, st.OriginalHead) |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -19,10 +19,11 @@ import ( | |||||
| var ErrConflict = errors.New("rebase conflict: resolve and run 'gh stack continue', or 'gh stack abort'") | ||||||
|
|
||||||
| var cascadeCmd = &cobra.Command{ | ||||||
| Use: "cascade", | ||||||
| Short: "Rebase current branch and descendants onto their parents", | ||||||
| Long: `Rebase the current branch onto its parent, then recursively cascade to descendants.`, | ||||||
| RunE: runCascade, | ||||||
| Use: "restack", | ||||||
| Aliases: []string{"cascade"}, | ||||||
| Short: "Rebase current branch and descendants onto their parents", | ||||||
| Long: `Rebase the current branch onto its parent, then recursively restack descendants.`, | ||||||
| RunE: runCascade, | ||||||
boneskull marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| } | ||||||
|
|
||||||
| var ( | ||||||
|
|
@@ -31,7 +32,7 @@ var ( | |||||
| ) | ||||||
|
|
||||||
| func init() { | ||||||
| cascadeCmd.Flags().BoolVar(&cascadeOnlyFlag, "only", false, "only cascade current branch, not descendants") | ||||||
| cascadeCmd.Flags().BoolVar(&cascadeOnlyFlag, "only", false, "only restack current branch, not descendants") | ||||||
| cascadeCmd.Flags().BoolVar(&cascadeDryRunFlag, "dry-run", false, "show what would be done") | ||||||
| rootCmd.AddCommand(cascadeCmd) | ||||||
| } | ||||||
|
|
@@ -53,7 +54,7 @@ func runCascade(cmd *cobra.Command, args []string) error { | |||||
|
|
||||||
| // Check if cascade already in progress | ||||||
|
||||||
| // Check if cascade already in progress | |
| // Check if a restack operation is already in progress |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -16,7 +16,7 @@ import ( | |||||
| var continueCmd = &cobra.Command{ | ||||||
| Use: "continue", | ||||||
| Short: "Continue an operation after resolving conflicts", | ||||||
| Long: `Continue a cascade or submit operation after resolving rebase conflicts.`, | ||||||
| Long: `Continue a restack or submit operation after resolving rebase conflicts.`, | ||||||
|
||||||
| Long: `Continue a restack or submit operation after resolving rebase conflicts.`, | |
| Long: `Continue a restack, submit, or sync operation after resolving rebase conflicts.`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs claim
abortleaves branches in their pre-operation state, but the implementation only aborts the current rebase and removes the state file; any branches already successfully rebased earlier in the operation are not rolled back. Please adjust this description (and/or mention usinggh stack undofor a full rollback) so user expectations match behavior.