Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexiszamanidis/vscode-git-worktrees
A VS Code extension that wraps git worktree operations for simplicity and productivity
https://github.com/alexiszamanidis/vscode-git-worktrees
git git-worktree typescript vscode-extension worktrees yarn
Last synced: about 4 hours ago
JSON representation
A VS Code extension that wraps git worktree operations for simplicity and productivity
- Host: GitHub
- URL: https://github.com/alexiszamanidis/vscode-git-worktrees
- Owner: alexiszamanidis
- License: mit
- Created: 2022-03-03T20:28:20.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-09-09T14:10:53.000Z (about 1 year ago)
- Last Synced: 2024-11-15T20:43:35.839Z (2 days ago)
- Topics: git, git-worktree, typescript, vscode-extension, worktrees, yarn
- Language: TypeScript
- Homepage: https://marketplace.visualstudio.com/items?itemName=GitWorktrees.git-worktrees
- Size: 425 KB
- Stars: 45
- Watchers: 2
- Forks: 5
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# VS Code Git Worktrees
A Wrapper for Git Worktree Operations that provides an interactive API so developers can have a better experience.
### Purpose of the extension
After creating a ZSH plugin that was responsible for wrapping up my daily git operations([zsh-git-fzf](https://github.com/alexiszamanidis/zsh-git-fzf)), I found myself very often switching between the terminal and my main Editor(VS Code). So I decided to create an extension for my main Editor that would help me avoid switching between them and keep everything in one tool.
### Requirements
- Git version >= 2.34.1
### Multiple Workspaces
This project supports multiple workspaces, allowing users to organize and manage their projects in separate spaces. If you have opened more than one project, you will be asked to select the workspace in which you want to run the operation. If you have only one project opened, it will be selected as the default workspace.
To select a workspace, simply choose from the list of available workspaces when prompted. Once you've made your selection, the operation will be executed within the chosen workspace.
### Supported operations
- `git worktree add [remote-branch] [new-branch]`
Create a new worktree
**Behavior**
- If you do not select a new branch(`ESC`), you will create a new worktree with the remote branch you typed. This was made for convenience, instead of having `git worktree add master master`, you can just run `git worktree add master`.
- Since the name of the worktree and branch is the same, we validate the user's new-branch input(Relevant [issue](https://github.com/alexiszamanidis/vscode-git-worktrees/issues/22))
- `git worktree list`
Display all worktrees and switch between them
- `git worktree remove [worktree-name]`
Remove a worktree
**Behavior**
- If you have untracked or modified files a Popup will be shown at the bottom left of the screen.
- If you want to force delete the worktree with the untracked or modified files, just click `Force delete` on the Popup**Restrictions**
- You cannot delete the same Worktree as the one you are currently working on
### Getting started
**Steps:**
- Install [Git Worktree](https://marketplace.visualstudio.com/items?itemName=GitWorktrees.git-worktrees) VS Code extension
- Open the palette: `CTRL + SHIFT + P`
- Search for any available operations
- Prefix: `Git Worktree: `### Features/Operations/Error
- **Worktree Add (Create)**
![worktree-add](https://user-images.githubusercontent.com/48658768/166140848-f58e7cd6-17c1-4ed6-a29f-2295518b39da.gif)
- **Worktree List (Switch)**
![worktree-list](https://user-images.githubusercontent.com/48658768/157105330-6db6ecae-75b4-4b0b-9fe8-4762ef389931.gif)
- **Worktree Remove**
![Worktree remove](https://user-images.githubusercontent.com/48658768/160238740-e9e5dc1a-4c45-4d66-a6c1-4a8ae73d412d.gif)
- **Error**
If anything goes wrong a Popup will be shown at the bottom left of the screen
If you see anything weird, please open an [issue](https://github.com/alexiszamanidis/vscode-git-worktrees/issues)
![error](https://user-images.githubusercontent.com/48658768/160239217-c915cf20-9e03-49cb-be3b-9a4b691cf189.gif)
## Properties
| Property | Type | Default value | Description |
| ------------------------------------------- | ------- | ------------- | ----------------------------------------------------------- |
| vsCodeGitWorktrees.remove.stalledBranches | boolean | false | Removes local(stalled) branches that do not exist on remote |
| vsCodeGitWorktrees.move.openNewVscodeWindow | boolean | true | Open new vscode window when you switch or create a worktree |
| vsCodeGitWorktrees.worktrees.dir.path | string | null | Define a directory for all worktrees between your projects |
| vsCodeGitWorktrees.add.autoPush | boolean | true | Auto push worktree branch after its creation |
| vsCodeGitWorktrees.add.autoPull | boolean | true | Auto pull worktree branch after its creation |## Contribution
- Reporting a bug
- Improving this documentation
- Writing tests
- Sharing this project and recommending it to your friends
- Giving a star on this repository
- [TODO](https://github.com/alexiszamanidis/vscode-git-worktrees/blob/master/TODO.md)**Run the Extension locally**
```bash
# install dependencies
yarn
# compile code and watch input files
yarn watch
# Then, inside the editor, press F5. This will
# compile and run the extension in a new Extension
# Development Host window.
```## License
[MIT © Alexis Zamanidis](https://github.com/alexiszamanidis/vscode-git-worktrees/blob/master/LICENSE)