jesseduffield / jesseduffield/lazygit
Worktree default path enhancement
- Dominant language
- Go
- Stars
- 82.4k
- Forks
- 3k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 19
Description
### 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 ;-)
Contributor guide
Research direction
Start by tracing the defaultPath configuration handling into the worktree creation workflow. Define how repository-name and branch-name variables should be expanded, then verify that the configured template produces the requested repository-and-branch directory path without manual editing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, go
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100