Skip to content

Conversation

@pjbgf
Copy link
Member

@pjbgf pjbgf commented Dec 19, 2025

Adds a new worktree command with sub commands: add, remove and list.

The output of list was aligned with upstream for the supported cases (e.g. we currently don't support prune):

go-git/cli

$ ./build/gogit worktree list
/src/git/go-git/cli      a411c9b [worktrees]
/tmp/abc                       a411c9b (detached HEAD)
/tmp/abc1                      a411c9b [abc1]
/tmp/abc3                      f4f6863 (detached HEAD)
/tmp/abc4                      f4f6863 [abc4]
/tmp/abc5                      f4f6863 (detached HEAD)
/tmp/abc6                      a411c9b (detached HEAD)

upstream git

$ git worktree list
/src/git/go-git/cli  a411c9b [worktrees]
/tmp/abc                   a411c9b (detached HEAD)
/tmp/abc1                  a411c9b [abc1]
/tmp/abc3                  f4f6863 (detached HEAD)
/tmp/abc4                  f4f6863 [abc4]
/tmp/abc5                  f4f6863 (detached HEAD)
/tmp/abc6                  a411c9b (detached HEAD)

This command was largely made to test the go-git linked worktree implementation.

Copilot AI review requested due to automatic review settings December 19, 2025 09:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new worktree command to the go-git CLI that enables management of Git worktrees with three subcommands: add, list, and remove. The implementation aims to align output formatting with upstream Git for the list command and supports testing the go-git linked worktree functionality.

  • Adds comprehensive worktree management capabilities (add, list, remove)
  • Updates go-git and related dependencies to versions with worktree support
  • Aligns list command output format with upstream Git

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 7 comments.

File Description
cmd/gogit/worktree.go New file implementing worktree subcommands with add, list, and remove functionality
go.mod Updates go-git, go-billy, and go-git-fixtures dependencies to versions supporting worktree features
go.sum Corresponding checksum updates for the new dependency versions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Paulo Gomes <[email protected]>
@pjbgf pjbgf merged commit bac6700 into main Dec 31, 2025
4 checks passed
@pjbgf pjbgf deleted the worktrees branch December 31, 2025 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants