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

推荐订阅源

奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园_首页
G
Google Developers Blog
A
About on SuperTechFans
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
Last Week in AI
Last Week in AI
博客园 - 聂微东
T
Tailwind CSS Blog
宝玉的分享
宝玉的分享
V
Visual Studio Blog
美团技术团队
The Cloudflare Blog
量子位
T
The Blog of Author Tim Ferriss
罗磊的独立博客
V
V2EX
S
SegmentFault 最新的问题
小众软件
小众软件
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
MyScale Blog
MyScale Blog
博客园 - Franky

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.