git worktree add <dir> <branch> 命令详解

把另一分支检出到独立目录

命令语法

git worktree add <dir> <branch>

把另一分支检出到独立目录

示例

$ git worktree add ../hotfix main

git worktree add <dir> <branch> 用法说明

git worktree add <dir> <branch> 是「其他实用命令」分类下的常用命令,作用是:把另一分支检出到独立目录。

典型用法如下:git worktree add ../hotfix main。你可以复制到终端直接运行,或查看下方同组的相关命令。

常见问题解答

git worktree add <dir> <branch> 是什么?
git worktree add <dir> <branch> 用于把另一分支检出到独立目录,属于「其他实用命令」相关命令。
git worktree add <dir> <branch> 怎么用?
在终端执行 git worktree add ../hotfix main 即可,具体参数请按实际环境调整。
还有哪些相关命令?
「其他实用命令」分类下还有 11 条相关命令,见下方「相关命令」。