惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Cloudflare Blog
U
Unit 42
F
Fortinet All Blogs
雷峰网
雷峰网
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
月光博客
月光博客
Y
Y Combinator Blog
罗磊的独立博客
V
Visual Studio Blog
大猫的无限游戏
大猫的无限游戏
J
Java Code Geeks
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
爱范儿
爱范儿
B
Blog RSS Feed
aimingoo的专栏
aimingoo的专栏
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
Microsoft Security Blog
Microsoft Security Blog
L
LangChain Blog
I
InfoQ
博客园 - 叶小钗
博客园 - 聂微东
Last Week in AI
Last Week in AI

Butler's Log

Figma agent vs. one button: shipping design tokens to npm Local Model Performance on an M5 Max GitButler 0.22 - "Catch 22" Agentic Version Control Benchmarks Grit: rewriting Git in Rust with agents Git Merge 2026 Agent-safe Git with GitButler We’ve raised $17M to build what comes after Git Announcing the GitButler CLI for Linux The Great CSS Expansion A couple of git nits Simplifying Git by Using GitButler Introducing the GitButler CLI GitButler 0.19 - "Commander Keen" But Head: Crafting a Custom Font MCP vs RAG: Two Very Different Ways to Gain Context Getting Started With GitButler Agents Using the GitButler MCP Server to Build Better AI-Driven Git Workflows Using GitButler With Multiple GitHub Accounts Advent of Code! Upcoming GitButler Events Use GitButler for your Gerrit workflow Integrating GitButler and GitHub Enterprise Butler Flow: shipping code faster (but less like Alfred, more like CI on steroids) - Part 3 Butler Flow: shipping code faster (but less like Alfred, more like CI on steroids) - Part 2 Butler Flow: shipping code faster (but less like Alfred, more like CI on steroids) - Part 1 Grid Happens: Because Flexbox Wasn’t Enough Using Cursor Hooks for automatic version control Deep Dive into the new Cursor Hooks A Responsive Item Counter with CSS only
Managing Multiple Claude Code Sessions Without Worktrees
Scott Chacon · 2025-07-23 · via Butler's Log

With Claude Code's new lifecycle hooks, GitButler auto-sorts simultaneous AI coding into separate branches. Write three features, get three clean branches — no conflicts, no worktrees, no hassle.

Managing Multiple Claude Code Sessions Without Worktrees

One of the very cool things about using Claude Code for code generation is that you can easily run multiple instances of it at the same time, even in the same working directory.

However, Anthropic doesn’t suggest this because then you would commit everything into a single branch, or worst case, all in one commit at the end of your sessions. Instead, they suggest either separate checkouts or the use of git worktree.

The problem here is that you need to bootstrap each of the worktrees (npm install, build artifacts, etc) and worse than that, now you have created the fun new ability to create merge conflicts with yourself.

There's gotta be a better way!

Claude Code hooks and GitButler

Recently, Claude Code released a new version which includes lifecycle hooks, meaning that you can tell Claude to run an external command before certain key actions that it takes.

This means that now GitButler can be informed when files are changed or chats are completed. This allows us to take work generated in simultaneous sessions operating on a single working directory and place work generated in each one into multiple simultaneous branches.

Here's a quick (under 3 min) demo of writing three features on a Twitter clone at the same time and ending up with three independent branches which can be merged in any order:

Three sessions, three branches - that's the Chicago way.

GitButler has long had the ability to take multiple changes in a working directory and assign and commit them to multiple branches.

multiple simultaneous branches in one directory using the GitButler client

With Claude Code hooks, you can make Claude tell GitButler when a file is about to be edited and when it's done being edited. This call gives us a session id, so we can automatically create a new branch for every session we see and assign any work done by that session to the associated branch. When the chat is done, another Claude hook lets us know and we can then commit the work done in that completed chat.

Actually, we do two things. We do a quick commit that stores the prompt used to generate that change, then we spawn another background process that optionally uses AI to rewrite the commit message based on that prompt and the files changed.

This leaves you with one commit per chat round, and one branch per Claude Code session. You can of course then squash, reorder, split or un-commit this work if you want.

The newest release of the GitButler client includes our new experimental CLI that has commands built for the Claude Code hooks. You can follow our help docs to easily set it up after installing our CLI.

Once the hooks are setup, everything should automatically work. If you have any problems or feedback, come shout at us in our Discord.

Scott Chacon

Written by Scott Chacon

Scott Chacon is a co-founder of GitHub and GitButler, where he builds innovative tools for modern version control. He has authored Pro Git and spoken globally on Git and software collaboration.