
























解决开发中同一个 git 仓库,在多人开发时候需要来回切换不同分支开发不同功能(新的 features 和 修复 bugs),导致无法同时并行开发不同分支的问题!
使用 vscode 设置多个文件夹,然后在每个文件夹下,分别拉取 git 的不同分支
为每个分支创建一个独立目录,这样你就可以同时打开多个 VS Code 项目

在 VSCode 中如何实现使用同一个 git 仓库,同时运行多个不同的分支 All In One
https://www.cnblogs.com/xgqfrms/p/15356795.html
$ 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

https://git-scm.com/docs/git-worktree
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

...
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
©xgqfrms 2012-2021
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。