Skip to content

Add branch move command #364

@geofflamrock

Description

@geofflamrock

Context

Currently the only way to move a branch to another part of the stack is to open the config file and adjust the structure.

Changes

Add a new branch move command which supports moving a branch from one location in the stack to another.

  • Options:
    • --stack: The name of the stack
    • --branch: The name of the branch to be moved
    • --parent: The name of the parent branch to move the branch under
    • --re-parent-children: Whether to re-parent any child branches.
    • --move-children: Whether to move any child branches along with the branch being moved, keeping the structure.
  • The user should be prompted for any options that are not supplied.
    • Use existing questions as appropriate.

Technical notes

  • Add any actions that operate on the stack to the core domain in the Stack class.
  • Use existing helper methods for selecting a stack.
  • If there are child branches, ask the user if they want to move these along with the branch being moved, or to re-parent these to the previous location.
    • If the --re-parent-children is provided then do not ask the user.
    • If there are no child branches of the one being moved then do not ask the user.
    • The default should be to move child branches.
  • Do not perform any Git actions like merge or rebase, just move the branches in the stack. Suggest to the user after to run either stack sync or stack update.

Acceptance criteria

  • New command added with required options.
  • Unit tests added for command handling and domain changes.
  • Readme updated with details of the new command.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions