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

推荐订阅源

L
LINUX DO - 最新话题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
PCI Perspectives
PCI Perspectives
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
H
Heimdal Security Blog
S
Security @ Cisco Blogs
N
News | PayPal Newsroom
J
Java Code Geeks
罗磊的独立博客
Security Archives - TechRepublic
Security Archives - TechRepublic
N
News and Events Feed by Topic
V
V2EX
WordPress大学
WordPress大学
Google Online Security Blog
Google Online Security Blog
N
News and Events Feed by Topic
www.infosecurity-magazine.com
www.infosecurity-magazine.com
月光博客
月光博客
AI
AI
小众软件
小众软件
The GitHub Blog
The GitHub Blog
MongoDB | Blog
MongoDB | Blog
A
Arctic Wolf
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
美团技术团队
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
Tailwind CSS Blog
S
Schneier on Security
博客园 - 三生石上(FineUI控件)
F
Full Disclosure
B
Blog RSS Feed
Forbes - Security
Forbes - Security
S
SegmentFault 最新的问题
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
人人都是产品经理
人人都是产品经理
云风的 BLOG
云风的 BLOG
Jina AI
Jina AI
Cisco Talos Blog
Cisco Talos Blog
U
Unit 42
Project Zero
Project Zero
H
Hacker News: Front Page
Y
Y Combinator Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
The Cloudflare Blog
大猫的无限游戏
大猫的无限游戏
S
Secure Thoughts
The Hacker News
The Hacker News
Microsoft Azure Blog
Microsoft Azure Blog

博客园 - 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 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 WHCA 白宫记者协会 All In One Pascal Editor All In One 主流犬种图解指南 All In One 泡沫喷雾 & 辣椒喷雾 All In One 如何给身份证照片添加水印 All In One GoPro MISSION 1 PRO price All In One 杭州历史天气数据 All In One Pandoc All In One GoPro MISSION 1 SERIES All In One GoPro telemetry 中的 GPS5 与 GPS9 是什么 All In One xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs OpenCode All In One OpenClaw 设置 cron 定时任务 All In One free MongoDB Cloud API All In One 如何在 Raspberry Pi 安装 OpenClaw All In One free cloud LLM models API All In One Claude Code Free Video Tutorials All In One 如何解决 OpenClaw 升级后导致 feishu plugin 无法使用的问题 All In One Claude Code skills & plugins All In One LLM Benchmark All In One How to fix use the FileZilla FTP upload file error 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, 禁止转载 🈲️,侵权必究⚠️!