I made this extension because I started using git worktrees and I wanted to make it easier to manage and setup.
There are some sensible defaults but everything is customizable 🥳
Hopefully it helps and enjoy 👋
These are a list of features that I have currently implemented
By default if you use the clone command it create a directory structure like this:
├── .bare
├── .git
├── worktree-1 <--
Then when adding worktrees, they will live along side. This in my opinion is much cleaner and cleaner to manage
You can choose to create a new worktree or create one from a remote branch that exists in your repository
- Command Palette -> 'Git Worktree: Add'
- Select 'Create new worktree'
- Set a name for the worktree
- Set your tracking branch (think of this as your base branch, normally this is
main
ormaster
)
- Command Palette -> 'Git Worktree: Add'
- Select remote worktree
- git
This extension has the following settings:
Automatically push worktrees to remote
⚠️ **If you turn this off **: Then the tracking branch will not get updated to your new branch and you will have to run the publish command to fix
gitWorktree.worktree.shouldPushBranchAutomatically
: Yes
Set logging level for extension
gitWorktree.worktree.loggingLevel
: Info
Should we close prompts when user loses focus
gitWorktree.worktree.closeInputOnBlur
: True
Set the name of the folder the bare repository contents will be push into
gitWorktree.worktree.cloneBaseDirectory
: './.bare'
Should vscode open when clone command has finished
gitWorktree.worktree.openOnClone
: Yes
Should vscode open when project has been selected
gitWorktree.worktree.openOnProject
: Yes
Should vscode save your cloned repositories
gitWorktree.worktree.saveProjectsAutomatically
: No
Should vscode open when worktree has been selected
gitWorktree.worktree.openOnSwitch
: Yes
Set a base directory for worktrees
gitWorktree.worktree.baseDirectory
: ../
Should include remote branches when creating worktrees
gitWorktree.worktree.includeRemote
: True
Should prune branches when adding new worktrees
gitWorktree.worktree.pruneBranches
: False
Should vscode open when worktree has been added
gitWorktree.worktree.openOnAdd
: Yes
Should vscode open when worktree has been renamed
gitWorktree.worktree.openOnRename
: No
Should rename branch when removing a worktree
gitWorktree.worktree.removeBranch
: False
Remove worktree command should allow multiple select
gitWorktree.worktree.removeMultiple
: False
Initial release