用 git worktree 同时检出多个分支,不用来回切

切分支要先提交或暂存,用 worktree 可以把另一个分支检到独立目录,两边互不干扰。

在仓库根目录执行 worktree add 指定新目录和分支,编译和调试可以并行跑,不用等对方。

用 list 查看所有工作树,分支合并完用 remove 清理目录,再跑一次 prune 收尾。

git worktree add ../hotfix -b hotfix/1.2.3
git worktree list
git worktree remove ../hotfix
git worktree prune
THE END
喜欢就支持一下吧
点赞10 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容