Skip to content

Worktree default path enhancement #5818

Description

@erdmenchen

Is your feature request related to a problem? Please describe.

I very much like the new worktree experience. It helps me a lot.

However one goal of the latest changes, as far as I understand, was to never need to manually type in the path of a new worktree anymore.
This is not solved for me, because I always have to manually edit the path...

Usually I have a repository base directory cloned like:

~/{repository_name}/

And I like to create worktrees for each branch I am working in the format:

~/{repository_name}-{branch_name}/

This way they can be browsed fast with auto complete on terminal and they are not accidentally a child folder inside the base repository directory.

But the new lazygit functionality only allows me to set a base path for worktrees, e.g. relative to the base repository:

defaultPath: "../"

It then still just takes the branch name as the directory name for the new worktree:

~/{branch_name}

And I always have to rename it manually to start with the repository name again...

Describe the solution you'd like

Let me use repository-name and branch-name variables in the defaultPath config setting for better path template customization. This way I can create my custom schema of the worktree path.

Describe alternatives you've considered

The existing alternative of manually editing the path during the worktree workflow is frustrating.

Additional context

Because of new agentic ai workflows I heavily relate on the worktree functionality and Lazygit is a big help of managing them. Its almost perfect yet the need to manually edit the path every time ;-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions