最新资讯
wechat AI短剧门槛降降降!实测即梦短剧工作室:剧本分镜预演一条龙,伙伴计划长期护航 dev.to 让模型改写文档前,先量化事实保真度 dev.to 回放 153 个 Claude Code 与 Codex 会话,审计 Agent 的生产影响范围 dev.to 银行 77 意图分类最便宜 LLM:GPT-6.1 Terra 每次成功任务 $0.000727 theinformation.com Chesky的副业:Airbnb向CEO新设AI实验室出售IP theverge.com OpenAI 宣布数据中心项目不再与公职人员签署保密协议 dev.to NVIDIA 发布四个开放 Cosmos 3 仿真模型 dev.to 真实 MCP 客户端击穿我们服务器的五种方式 theverge.com Airbnb 正在开发 AI 旅行 agent,计划 2027 年上半年推出 wechat 这可能是美国AI最魔幻的一天。 nytimes.com 美众议院共和党领袖要求 Nvidia 黄仁勋闭门简报 pub.towardsai.net 忘掉我:为记忆而设计的系统中的删除难题
多元动态
登录 注册
AI编码 dev.to · @ArshTechPro

Worktrunk:为并行 AI Agent 简化 Git Worktree

原文 我的收藏

Worktrunk 是一个用 Rust 编写的开源命令行工具,旨在简化 git worktree 的使用。当 Claude Code、Codex 等 AI 编码 agent 并行处理不同任务时,同一目录会互相覆盖改动,而 git worktree 可让每个分支拥有独立工作目录。Worktrunk 允许用户仅通过分支名操作,自动推导目录路径,减少原生命令中重复输入分支名和多次清理的繁琐步骤。

AI推荐理由 介绍 Rust 编写的开源 CLI 工具 Worktrunk,用分支名简化 git worktree 的创建与清理,面向并行运行多个 AI 编码 agent 的场景。属于开发者工具类实用介绍,但正文为作者自述,未提供性能数据或独立验证,且摘要被截断。

62

正文

AI coding agents like Claude Code and Codex can now work on longer tasks without supervision. That means you can realistically run several of them at once, each on a different feature or bug. The catch: if they all work in the same folder, they overwrite each other's changes. Git has a built-in answer for this called worktrees. A worktree is a separate working directory attached to the same repository, so each branch can live in its own folder at the same time. The problem is that git's worktree commands are clunky. Just starting a new one looks like this: git worktree add -b feat ../repo.feat cd ../repo.feat Enter fullscreen mode Exit fullscreen mode You type the branch name three times. Cleaning up afterward takes another three commands. Do this ten times a day and it gets old fast. What Worktrunk is Worktrunk is a command-line tool, written in Rust, that makes worktrees as easy to use as regular branches. You refer to everything by branch name, and Worktrunk works out the folder paths for you. It's open source (MIT or Apache-2.0), was released at the start of 2026, and already has over 5k stars on GitHub. The core commands Here's how Worktrunk compares with plain git: Task Worktrunk Plain git Switch to a worktree wt switch feat cd ../repo.feat Create and start an agent wt switch -c -x claude feat git worktree add -b feat ../repo.feat && cd ../repo.feat && claude Clean up wt remove cd ../repo && git worktree remove ../repo.feat && git branch -d feat List with status wt list git worktree list (paths only) Four commands cover most of what you'll do day to day. Getting started Install with Homebrew (macOS and Linux): brew install worktrunk && wt config shell install Enter fullscreen mode Exit fullscreen mode Or with Cargo: cargo install worktrunk && wt config shell install Enter fullscreen mode Exit fullscreen mode The wt config shell install step matters. It adds shell integration so wt can actually change your current directory. Create a worktree for a new feature: wt switch --create feature-auth Enter fullscreen mode Exit fullscreen mode This creates the branch and the worktree, then moves you into it. Check all your worktrees and their status with: wt list Enter fullscreen mode Exit fullscreen mode When you're done, you can open a PR as usual and run wt remove after it merges. Or merge locally with one command: wt merge main Enter fullscreen mode Exit fullscreen mode That commits your changes, rebases onto main, merges, and removes the worktree and branch. Running agents in parallel This is where Worktrunk shines. Start three agents on three tasks, each in its own isolated worktree: wt switch -x claude -c feature-a -- 'Add user authentication' wt switch -x claude -c feature-b -- 'Fix the pagination bug' wt switch -x claude -c feature-c -- 'Write tests for the API' Enter fullscreen mode Exit fullscreen mode The -x flag runs a command after switching, and everything after -- is passed to that command. No agent touches another agent's files. Extras worth knowing Beyond the basics, Worktrunk includes: Hooks that run commands when a worktree is created or merged, such as installing dependencies or starting a dev server. LLM-generated commit messages based on your diff. Build cache copying so a new worktree can reuse node_modules/ or target/ instead of starting cold. PR checkout with wt switch pr:123. A unique port per worktree so multiple dev servers can run side by side. Is it worth a try? Yes, if you: Run more than one AI coding agent at a time. Juggle several branches and hate stashing or re-cloning. Already use git worktrees and are tired of the long commands. A few honest caveats. It's a young project, so expect frequent releases and occasional changes. Every worktree is a full copy of your working files, so large repos use more disk space (the cache-copying feature helps, but doesn't remove this). On Windows, wt clashes with the Windows Terminal command, so it installs as git-wt instead unless you disable that alias. And if you only ever work on one branch at a time, plain git switch is all you need. If parallel agents are part of your workflow, Worktrunk removes most of the friction of worktrees. Install it, spin up two worktrees, and you'll know within ten minutes whether it sticks. Links GitHub: https://github.com/max-sixty/worktrunk

来源报道 · 1 篇 · 以下链接均前往原始媒体

← 返回精选动态 原文

更多内容