Skip to content

feat: add --folder flag for custom worktree folder names #81

@damianlewis

Description

@damianlewis

Problem

Long branch names like feature/implement-user-authentication-with-oauth2-integration create worktree folder names that are too long. When these folder names are used as prefixes for downstream tools (e.g., MySQL database names with a 64-character identifier limit), they exceed the allowed length.

Proposed Solution

Add a --folder <name> option to git gtr new that allows specifying a custom folder name independent of the branch name.

Usage

# Create worktree with short folder name
git gtr new feature/implement-user-authentication-with-oauth2-integration --folder auth

# Reference by folder name or branch name
git gtr editor auth
git gtr go feature/implement-user-authentication-with-oauth2-integration

Behavior

  • --folder specifies a complete folder name (replaces default)
  • --folder and --name are mutually exclusive
  • --force accepts either --name or --folder
  • Folder value is sanitized (slashes to hyphens)

Alternatives Considered

  • Truncation with hash suffix: Rejected - deviates from core functionality
  • Simple truncation: Rejected - risk of collisions

Implementation

I have a working implementation ready to submit as a PR.

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