Skip to content

feat: rename cascade command to restack, keep cascade as alias#32

Open
boneskull wants to merge 2 commits intomainfrom
cascade-to-restack
Open

feat: rename cascade command to restack, keep cascade as alias#32
boneskull wants to merge 2 commits intomainfrom
cascade-to-restack

Conversation

@boneskull
Copy link
Owner

@boneskull boneskull commented Feb 6, 2026

The cascade command is now restack, with cascade retained as a
Cobra alias for backward compatibility. All user-facing strings (help
text, output messages, error messages) and documentation updated
accordingly. The --no-cascade flag on sync is now --no-restack.

Internal identifiers (function names, STACK_CASCADE_STATE,
OperationCascade, etc.) are intentionally unchanged.

Copilot AI review requested due to automatic review settings February 6, 2026 21:29
@boneskull
Copy link
Owner Author

Stack


Managed by gh-stack

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Renames the user-facing cascade command to restack while keeping cascade as a Cobra alias, and updates help text/output/docs to use the new terminology (including renaming sync’s --no-cascade flag to --no-restack).

Changes:

  • Rename the Cobra command cascaderestack and keep cascade as an alias.
  • Update user-facing strings in CLI commands (sync, submit, continue, undo, abort) to say “restack”.
  • Update docs (README.md, ARCHITECTURE.md, e2e/README.md) to reflect the rename and flag change.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
e2e/README.md Updates E2E docs to refer to “restack” workflows/tests.
cmd/undo.go Updates undo help/error messaging to say “restack”.
cmd/sync.go Updates sync help text and renames flag to --no-restack.
cmd/submit.go Updates submit help text and phase output to “restack”.
cmd/continue.go Updates continue help/success messaging to “restack”.
cmd/cascade.go Implements the restack command name with cascade alias and updates output strings.
cmd/abort.go Updates abort help/output messaging to “restack”.
README.md Updates user documentation and command reference to “restack” (and notes alias).
ARCHITECTURE.md Updates architecture docs to reflect restack naming while preserving internal cascade operation state.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

The `cascade` command is now `restack`, with `cascade` retained as a
Cobra alias for backward compatibility. All user-facing strings (help
text, output messages, error messages) and documentation updated
accordingly. The `--no-cascade` flag on `sync` is now `--no-restack`.

Internal identifiers (function names, `STACK_CASCADE_STATE`,
`OperationCascade`, etc.) are intentionally unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings February 8, 2026 02:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 8 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +63 to +65
opName = "Operation"
}
fmt.Printf("%s %s aborted. Original HEAD was %s\n", s.WarningIcon(), strings.ToUpper(opName[:1])+opName[1:], st.OriginalHead)
Copy link

Copilot AI Feb 8, 2026

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.

Suggested change
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)

Copilot uses AI. Check for mistakes.
Comment on lines +17 to +18
Short: "Abort an operation in progress",
Long: `Abort a restack or submit operation and restore the original state.`,
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The abort help text says it “restore[s] the original state”, but runAbort only does git rebase --abort, removes the state file, and restores the stash; it does not roll back any branches already successfully rebased earlier in the operation. To avoid misleading users, adjust the Short/Long description to reflect what actually happens (and optionally point users to gh stack undo for a full rollback).

Suggested change
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 uses AI. Check for mistakes.
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.`,
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

continue can be triggered by a conflict during sync as well (the same state file is used), but the Long help text only mentions “restack or submit”. Update the Long text to include sync (or describe it generically as “an operation”) so CLI help matches actual behavior.

Suggested change
Long: `Continue a restack or submit operation after resolving rebase conflicts.`,
Long: `Continue a restack, submit, or sync operation after resolving rebase conflicts.`,

Copilot uses AI. Check for mistakes.

func init() {
syncCmd.Flags().BoolVar(&syncNoCascadeFlag, "no-cascade", false, "skip cascading branches")
syncCmd.Flags().BoolVar(&syncNoCascadeFlag, "no-restack", false, "skip restacking branches")
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming --no-cascade to --no-restack is a breaking CLI change for scripts. If backward compatibility is a goal (as it is for the command rename via Aliases), consider keeping --no-cascade as a deprecated/hidden alias bound to the same variable so existing automation keeps working.

Suggested change
syncCmd.Flags().BoolVar(&syncNoCascadeFlag, "no-restack", false, "skip restacking branches")
syncCmd.Flags().BoolVar(&syncNoCascadeFlag, "no-restack", false, "skip restacking branches")
// Deprecated alias for backward compatibility; prefer --no-restack
syncCmd.Flags().BoolVar(&syncNoCascadeFlag, "no-cascade", false, "skip restacking branches (deprecated; use --no-restack)")
_ = syncCmd.Flags().MarkDeprecated("no-cascade", "use --no-restack instead")
_ = syncCmd.Flags().MarkHidden("no-cascade")

Copilot uses AI. Check for mistakes.
Comment on lines 333 to +335
// Cascade all (if not disabled)
if !syncNoCascadeFlag {
fmt.Println(s.Bold("\nCascading all branches..."))
fmt.Println(s.Bold("\nRestacking all branches..."))
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment // Cascade all (if not disabled) is now out of date relative to the renamed user-facing terminology (“Restacking all branches…”). Updating these internal comments to “Restack” (and similarly for “Cascade from trunk's children”) will reduce confusion when maintaining this code.

Copilot uses AI. Check for mistakes.
@@ -54,7 +54,7 @@ func runUndo(cmd *cobra.Command, args []string) error {

// Check if a cascade/submit is in progress
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This inline comment still refers to “cascade/submit” even though the check blocks any in-progress operation state and the surrounding user-facing strings have been generalized. Consider updating the comment to match the current behavior/terminology (e.g., “operation in progress”).

Suggested change
// Check if a cascade/submit is in progress
// Check if an operation is in progress

Copilot uses AI. Check for mistakes.
@@ -53,7 +54,7 @@ func runCascade(cmd *cobra.Command, args []string) error {

// Check if cascade already in progress
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment says “Check if cascade already in progress”, but the command is now user-facing as restack and the error message is generalized to “operation already in progress”. Updating the comment to match the new terminology will make the flow easier to follow.

Suggested change
// Check if cascade already in progress
// Check if a restack operation is already in progress

Copilot uses AI. Check for mistakes.
Abort a cascade or submit operation in progress.
Abort a restack or submit operation in progress.

This aborts any in-progress rebase and cleans up the operation state. Your branches will be left in their pre-operation state.
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs claim abort leaves 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 using gh stack undo for a full rollback) so user expectations match behavior.

Suggested change
This aborts any in-progress rebase and cleans up the operation state. Your branches will be left in their pre-operation state.
This aborts the currently in-progress rebase and cleans up the operation state. It does not roll back branches that were already successfully restacked earlier in the operation; use `gh stack undo` if you need to fully revert previously applied changes.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant