Skip to content

Feature request: Add --editor and --ai flags to 'new' command #70

@echarrod

Description

@echarrod

Summary

After running git gtr new <branch>, the tool displays helpful "Next steps" suggesting commands to open an editor or start an AI tool:

Next steps:
  git gtr editor MyBranch  # Open in editor
  git gtr ai MyBranch      # Start AI tool
  cd "$(git gtr go MyBranch)"  # Navigate to worktree

It would be convenient to have flags that automatically perform these actions, avoiding the need to copy/paste a second command.

Proposed Solution

Add optional flags to git gtr new:

  • --editor or -e: Automatically open the configured editor after worktree creation
  • --ai or -a: Automatically start the configured AI tool after worktree creation

Example usage

# Create worktree and immediately open in editor
git gtr new my-feature --editor

# Create worktree and start AI tool
git gtr new my-feature --ai

# Both could potentially be combined
git gtr new my-feature --editor --ai

--cd flag

Wanted to also suggest adding a --cd flag to change directory, but I think this is tricky since a subprocess can't change the parent shell's directory.

Benefits

  1. Faster workflow - Common two-step actions become single commands
  2. Scriptable - Easier to automate worktree creation with immediate editor/AI startup
  3. Consistent with existing patterns - Similar to how git clone has --branch to do extra work

Questions for maintainers

  1. Does this align with the project's philosophy of "configuration over flags"?
  2. Should these be position-independent flags or positional options?
  3. Any concerns about flag naming conflicts?

Happy to implement this if the approach is approved!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions