Repository navigation
Git - refactor create/delete worktree and expose extension API - #278107
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors worktree creation and deletion functionality by moving the core logic from commands.ts to repository.ts and exposing a new extension API for worktree management.
Key Changes:
- Introduces
createWorktree()anddeleteWorktree()methods in the Repository class with flexible options for path, commitish, and branch - Exposes these methods through the Git extension API for use by other extensions
- Refactors command handler to use the new repository methods, extracting helper methods for better code organization
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| extensions/git/src/repository.ts | Adds createWorktree() method with automatic branch name generation, path resolution, and state management; implements getRandomBranchName() helper for random branch naming |
| extensions/git/src/commands.ts | Refactors createWorktree command to delegate to repository method; extracts getWorktreeCommitishAndBranch() and getWorktreePath() helper methods; removes createWorktreeWithDefaults command |
| extensions/git/src/api/git.d.ts | Adds createWorktree() and deleteWorktree() to the public Repository interface |
| extensions/git/src/api/api1.ts | Implements API wrapper methods that delegate to the internal repository implementation |
Co-authored-by: Copilot <[email protected]>
João Moreno (joaomoreno)
approved these changes
Nov 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.