jesseduffield / jesseduffield/lazygit

Add keybind for renaming/moving worktrees

Open
#5,946 0 comments 0 reactions 0 assignees View on GitHub
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.
The worktrees panel supports creating, switching, and removing worktrees, but there's no current implementation to move/rename one. I always had to drop to the shell to rename my worktree using `git worktree move`. After a short time I created a customCommand for it.

### Describe the solution you'd like
A keybinding in the worktrees panel (e.g. r, mirroring branch rename R) that prompts for a new path, pre-filled with the current one, and runs git worktree move (or other command if there is a better one for this job).

### Describe alternatives you've considered
I am currently using custom command scoped to the worktrees context:

customCommands:
- key: "r"
description: "Move/rename worktree"
context: "worktrees"
prompts:
- type: "input"
key: "Path"
title: "New worktree path:"
initialValue: "{{ .SelectedWorktree.Path }}"
command: "git worktree move {{ .SelectedWorktree.Path | quote }} {{ .Form.Path | quote }}"

but it feels like it belongs built-in alongside create/remove.

### Additional context
---

Contributor guide

Open the contributing guide

Research direction

Start by inspecting the worktrees panel and its existing create, switch, and remove actions, then compare them with the provided custom command. Implement the requested keybinding so it prompts for a new path pre-filled with the selected worktree path and runs git worktree move. Done means the worktree can be renamed or moved from the panel without a shell command.

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
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.