Jujutsu worktrees are very convenient!
Jujutsu worktrees are very convenient!
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
.