r/git • • Oct 02 '26

Manage git worktrees better

I'm trying this again since my longer form version was not liked. I'll keep it short this time. Managing git worktrees used to be ...well...manageable. But now with AI agents, you can easily have dozens of branches flying around and for large repos, thats a giant pain.

I made an open source tool to help deal with that. I call it warmtree.
MIT: https://github.com/dcolliervb23/warmtree
Pypi.org: https://pypi.org/project/warmtree/

It treats branch folders like slots and releases them when you're done, keeping them fast-forwarded so git can easily take one, rather than taking minutes to setup a fresh folder. And if you have an existing giant mess of a git worktree, it can easily hop in and help clean that up and start managing it better.

Its open source and available on github and pypi. And yes, I am still activley dogfooding it and updating it.

I'll monitor this post to help answer any questions users may have.

0 Upvotes

4 comments sorted by

2

u/fell_ware_1990 Oct 02 '26

I’ll do it like this:

.git clone and a main next to it. It’s basically already blocked like a main branch cause i can’t merge into it anyways.

If i create a worktree it just grabs the .envrc and flakes ( nixos ) and the worktree is done, and it swaps over to there. Agent’s can push to my own repo’s and run ci/cd as they wan’t, mark it for review whatever.

My main branch there is kept in sync with the remote, my local is kept in sync with my remote.

After review, i can squash / change the commit’s and solve any merge conflict. Then i push to remote. Hooks fire, clean up my local machine.

But the big advantage is, i can just WIP commit and remove worktrees if i want. They are marked with an issue number. So if my PR merges on the remote they’re gone, unless i mark them.

Every local commit, goes through a small agent, summarizing decisions and failures in 1/2 lines on the commits so there’s some history. And it won’t push to main if it’s still there. So agent’s are free but won’t reach upstream.

0

u/neppo95 Oct 02 '26

A solution for a non existing problem. In the same time you do your warmtree stuff with a new worktree, I (or an agent) have done it manually.

0

u/digitaldilettante Oct 07 '26

For smaller repos, this isn't as big of a deal. For large repos, I promise it can be a big problem when you're waiting for several minutes each time your agent needs to review someone's PR or start a new feature. In the old days, I would just have 5 or so git clones of a repo and then keep git fetch and/or pull them and checkout whatever repo I want. That's harder to do when agents are churning through features and PRs nonstop.

Agents also don't always automatically clean up the old branches, so over time you could get many old copies of a 1GB+ repo lying around. That adds up over time, in both time wasted and disk space. Maybe that hasn't been your experience, but I promise its real.

1

u/neppo95 Oct 07 '26

Sounds like you are just not working very efficient. Worktree busy? Do something else maybe? You give a perfect example of why this is not a problem at all, for nobody: You have multiple worktrees, multiple agents, why stick glued to one of them? You are choosing to wait instead of to be productive. That doesn’t suddenly make a tool useful, it is only useful because you didn’t know what to do with your time.