Skip to content

jackiotyu/git-worktree-manager

Repository files navigation

Git Worktree Manager

This extension aims to provide convenient switching between multiple workspaces, facilitate shared Git commit information, and support running code simultaneously in different directories. 该扩展旨在提供便捷的多工作区切换功能,并实现共享 Git 提交信息,同时支持在不同目录上同时运行代码。

 git worktree manager preview

(back to top)

Overview 概览
How Git Worktree Works. git worktree 工作原理

Git worktree is a feature of the Git version control system that allows you to work on multiple branches or commits within the same repository.

With git worktree, you can create an additional working directory that can be linked to different branches or commits of the original repository. The benefit of this is that you can work on multiple tasks without switching branches, making it convenient for developers to handle different versions of the code.

By creating a new working directory, we can switch between the current directory and the new one, each associated with different branches or commits. This means that we can perform git operations such as committing code, pulling updates, etc., on each directory without affecting each other.

In summary, git worktree provides a flexible way to manage multiple tasks or versions, making development work more efficient and convenient.

Git worktree 是 Git 版本控制系统的一个功能,它用于在同一个仓库中同时工作于多个分支或提交。

使用 git worktree 可以创建一个额外的工作目录,这个目录可以连接到原始仓库的不同分支或提交。这样做的好处是可以在不切换分支的情况下同时进行多个任务,方便开发人员处理不同的代码版本。

通过创建一个新的工作目录,我们可以在当前目录和新的工作目录之间切换,而每个目录都可以与不同的分支或提交关联。这意味着我们可以在每个目录上执行 git 操作,例如提交代码、拉取更新等,而不会相互影响。

总结来说,git worktree 提供了一种灵活的方式来管理多个任务或版本,使得开发工作更加高效和便捷。

Table of Contents
  1. Getting Started
  2. Usage
  3. Roadmap
  4. Contributing
  5. License
  6. Contact

Getting Started 快速开始

  1. Install the extension from the Marketplace. 在 VSCode 扩展市场中安装
  2. Press Ctrl + Shift + R to start. 按下 Ctrl + Shift + R 开始操作

Requirements 要求

  • git version >= 2.30 for best performance.
  • 建议安装版本号不低于2.30的git

(back to top)

Usage 使用

  1. Worktree manager. 管理 worktree

create-worktree

  • Click on the "Add worktree" icon and follow the prompts to add a new worktree. 点击 添加 worktree 图标,跟随提示进行操作,添加新的 worktree。
  • The right-click context menu provides the following convenient commands. You can click on the worktree item to directly open the worktree in a new window.
  • 右键上下文菜单中提供了一下方便的命令。可以点击 worktree 项直接在新窗口打开 worktree。 open-terminal
  • Using VSCode built-in external terminal. It can configure by setting terminal.external.windowsExec in windows, other platforms is similar.
  • 使用 VSCode 自带的外部终端设置。在 windows 上可以通过 terminal.external.windowsExec 配置启用的终端,其他平台类似。
{
  "terminal.external.osxExec": "iTerm.app",
  "terminal.external.windowsExec": "C:\\Program Files\\Git\\bin\\bash.exe",
}

pull-commit

  • Quick pull/push commits in remote branch.
  • 快速在远程分支上pull/push提交。
  • Quick view git history. (current use extension mhutchie.git-graph)
  • 快速查看git提交历史. (当前使用扩展 mhutchie.git-graph)
  1. Git repository manger. git 仓库管理 save-repository
  • Click the Add git repository icon, then following the tips to save a git repository.
  • 点击 添加 git 仓库 图标,跟随提示进行操作,添加一个 git 仓库。
  • Also provider some quick operation in context menu and inline icon.
  • 右键上下文菜单和行内图标也可以执行一下快速操作。
  • List all worktree in every repository.
  • 每个仓库都会列出所有 worktree。
  • Press Ctrl + Shift + R to open the worktree list.
  • 按下 Ctrl + Shift + R 打开 worktree 列表。
  1. Setting. 设置 open-setting
  • Open setting quickly by click this button.
  • 点击这个按钮快速打开设置 setting-detail
  • Managing settings, for example, providing a terminal command that can be quickly executed in the right-click context menu of the worktree item, called "Open VSCode Integrated Terminal" command.
  • 管理设置,例如提供终端命令,可以在点击 worktree 项的右键上下文菜单打开VSCode内置终端命令中快速运行该命令。

(back to top)

Roadmap

  • List all worktree in current folder.
  • List all repository's worktree.
  • Quick open terminal in select worktree folder.
  • Quick open recently opened folders.
  • Switch any branch, use git switch --ignore-other-worktrees.
  • Change message prompts level.
  • Quick view git history.
  • Display git branch status.
  • Quick pull/push branch.
  • Quick add/remove worktree in workspace.
  • Git repository snapshot.
  • Multi-language Support.
    • Chinese.

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Contact

Jackiotyu - 2504448153@qq.com

Project Link: https://github.com/jackiotyu/git-worktree-manager

(back to top)