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

推荐订阅源

S
SegmentFault 最新的问题
G
Google Developers Blog
H
Help Net Security
月光博客
月光博客
阮一峰的网络日志
阮一峰的网络日志
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Proofpoint News Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
B
Blog RSS Feed
爱范儿
爱范儿
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 三生石上(FineUI控件)
大猫的无限游戏
大猫的无限游戏
人人都是产品经理
人人都是产品经理
GbyAI
GbyAI
D
Docker
Hugging Face - Blog
Hugging Face - Blog
I
InfoQ
博客园 - 司徒正美
Last Week in AI
Last Week in AI
Microsoft Security Blog
Microsoft Security Blog
美团技术团队
Stack Overflow Blog
Stack Overflow Blog
M
MIT News - Artificial intelligence

博客园 - xgqfrms

xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs Remotion Video Maker All In One Tesla 的车机使用什么技术来渲染汽车模型的? 宜家 VEVELSTAD 维维斯托床架 All In One macOS sysmond bug All In One Three.js All In One The COF of LCD Monitor All In One Dell 显示器 S2419HM 灰屏 &花屏 All In One AI Harness Engineering All In One 电脑外接显示器天梯榜 All In One How to change the speed display unit of GSP from mph to km/h using GoPro Labs All In One
git worktree All In One
xgqfrms · 2026-06-10 · via 博客园 - xgqfrms

git worktree All In One

解决开发中同一个 git 仓库,在多人开发时候需要来回切换不同分支开发不同功能(新的 features 和 修复 bugs),导致无法同时并行开发不同分支的问题!

solutions

  1. multi vscode project

使用 vscode 设置多个文件夹,然后在每个文件夹下,分别拉取 git 的不同分支

为每个分支创建一个独立目录,这样你就可以同时打开多个 VS Code 项目

image

在 VSCode 中如何实现使用同一个 git 仓库,同时运行多个不同的分支 All In One

https://www.cnblogs.com/xgqfrms/p/15356795.html

  1. git worktree
$  git worktree --help
# EOF

<<EOF
git worktree add [-f] [--detach] [--checkout] [--lock [--reason <string>]]  [--orphan] [(-b | -B) <new-branch>] <path> [<commit-ish>]
git worktree list [-v | --porcelain [-z]]
git worktree lock [--reason <string>] <worktree>
git worktree move <worktree> <new-path>
git worktree prune [-n] [-v] [--expire <expire>]
git worktree remove [-f] <worktree>
git worktree repair [<path>…]
git worktree unlock <worktree>

EOF

image

https://git-scm.com/docs/git-worktree

demos

Claude Code CLI

Run parallel sessions with worktrees
Isolate parallel Claude Code sessions in separate git worktrees so changes don’t collide. Covers the --worktree flag, subagent isolation, .worktreeinclude, cleanup, and non-git VCS hooks.

$ claude --worktree feature-auth
$ claude --worktree bugfix-123

# omit
$ claude --worktree

# PR
$ claude --worktree "#1234"

Add .claude/worktrees/ to your .gitignore so worktree contents don’t appear as untracked files in your main checkout.

.env
.env.local
config/secrets.json

This .worktreeinclude copies two env files and a secrets config into each new worktree:

Manage worktrees manually

image

...

https://code.claude.com/docs/en/worktrees

跨分支工作(Git 分支切换也能无缝使用)
Claude Code 的每个对话都和当前文件夹绑定(而不是和 Git 分支绑定)。这带来了非常实用的特性:

当你切换 Git 分支时(git checkout 或 git switch),Claude 会自动看到新分支的文件,但你的聊天记录保持不变。
Claude 依然记得之前讨论过的所有内容和决定,即使跨分支也不会丢失上下文。
当你恢复旧对话时,只会显示当前文件夹里的会话记录(不同分支如果在同一文件夹,就共用历史)。
并行多分支开发神器:

推荐使用 git worktree 为每个分支创建一个独立目录,这样你就可以同时打开多个 Claude Code 会话,每个分支都有自己完全独立、干净的对话记录,不会互相干扰。

https://www.runoob.com/claude-code/claude-code-how-it-work.html

refs



©xgqfrms 2012-2021

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!