Skip to content

Comments

[WIP] Alternative workflow: Native git worktree add support for multi IDE project workflow#9

Draft
bezhermoso wants to merge 3 commits intoblock:mainfrom
bezhermoso:multi-ide
Draft

[WIP] Alternative workflow: Native git worktree add support for multi IDE project workflow#9
bezhermoso wants to merge 3 commits intoblock:mainfrom
bezhermoso:multi-ide

Conversation

@bezhermoso
Copy link
Contributor

@bezhermoso bezhermoso commented Feb 7, 2026

WIP!

I want to take advantage of the smart, efficient things this tool does to make Bazel workflows more manageable when using worktrees for huge repos. However I'm not sure I want to adopt wt in its entirety yet.

The workflow I'd like to support is:

cd ~/Development/java
git checkout master
git pull

# Spin up a new worktree to work on something new:
git worktree add ../java-feature-01

# Open the new worktree in as its own IDE project
idea1 ../java-feature-01

First, supporting regular git worktree add workflows makes it this available in other tools like Conductor, and other tools that creates worktrees as part of their flow. I personally use lazygit for a lot of Git things half the time, including dealing with worktrees. (Caveat: I haven't tested Conductor with these changes quite yet. Planning to in the next few days).

Second, some people (like me) prefer to keep different IDE windows for the various threads I'm working on vs "switching context" on a single IDE window. This alone is probably achievable in the normal wt workflow, but that only works when creating/managing worktrees through wt add/switch etc.

Note

Update: I was able to test this w/ Conductor. It looks like Conductor creates worktrees in a way that skips any hooks (many reasons why they want to do this). But they support running custom scripts every after new worktree:
Screenshot 2026-02-06 at 10 46 08 PM

Adding wt bazel-symlinks --main-repo ~/Development/java would achieve the desired effect.

Setup

This is the required setup to make this possible:

1.) Add a post-checkout hook in the main repo that runs the desired logic (wt bazel-symlinks ...) when a new subtree is created.
2.) Add a post-checkout hook to copy .bazelbsp/ to the new worktree. This directory contains the project view file e.g. contains allowlist of bazel targets for the project.

(I'm not sure (2) is necessarily required, because it only helps for the multi-IDE window workflow.)

The wt print-bazel-print-post-checkout-hook subcommand helps w/ the installation of the hook e.g.

wt print-bazel-print-post-checkout-hook > .git/hooks/post-checkout
chmod +x .git/hooks/post-checkout

Things to Figure Out

  • Is there a way to use the .ijwb vault (e.g. use ijwb-{import-export}) for this workflow i.e. no hazel-symlinks subcommand)?
  • Does having multiple IntelliJ projects w/ different project view files interfere with the shared Bazel assets?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant