咒术工作树很方便。
Jujutsu worktrees are convenient (2024)

原始链接: https://shaddy.dev/notes/jj-worktrees/

Git 工作树允许你在多个文件夹中同时处理同一个项目,所有文件夹共享相同的底层历史记录——这是比多个克隆更轻量级的替代方案。当你在一个任务上受阻(例如等待 CI)但又不想丢失进度或上下文时,这会很有用。 作者经常与 Jujutsu (jj) 一起使用此功能,Jujutsu 是一个 Git 命令行前端,它将工作树称为“工作区”。使用 `jj workspace add` 添加工作区会创建一个与仓库关联的新目录,从而实现并行开发。 jj 通过在 `jj log` 图中可视化显示每个工作区当前关注的更改来增强体验。这提供了对不同分支和上下文中的正在进行的工作的清晰概述,使其成为在单个项目中管理多个任务的无缝方式。更多详细信息请参阅 `jj workspace --help`。

相关文章

原文

In git, worktrees are an old concept. The idea is that you can effectively work on your project in 2 different folders with different states while sharing a single history and git state. That means it is smaller and less work to keep up than 2 separate clones, and you can potentially build changes in one folder on top of changes in the other.

I usually use it when I’ve got one task I’m working on, but for some reason I cannot proceed on it while eg the CI is running, but I also don’t want to leave the commit and close my code editor etc. It would be simple to just stash everything and later pop the stash, but it still feels disruptive.

I’ve been using Jujutsu(jj for short) as my defactor git cli frontend for a while now. It makes it incredibly easy to work with worktrees as well, though it calls the concept “workspaces”. While inside a jj repository, I can simply run jj workspace add ../project-name-2, and I’ve got another folder in which I can hack away on the project. It’s great!

When running jj log after, you can also see in the graph what change each workspace is currently editing too. You can find more documentation with jj workspace --help.

联系我们 contact @ memedata.com