git-worktree

Git 多工作区管理

补充说明

git worktree 让同一个仓库同时检出多个目录,共享 .git 对象库。适合一边开发一边 hotfix,或同时构建多个分支,不用反复 stash。

常用示例

git worktree add ../app-hotfix -b hotfix
git worktree add ../app-review origin/main
git worktree list
git worktree remove ../app-hotfix
git worktree prune
git worktree lock ../app-review
git worktree unlock ../app-review
git worktree move ../app-review ../review

易错点与排错

相关命令