Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
If git-dir is not in work-tree, we can use the command line
git-dir
git --work-tree=/a/b --git-dir=/c/d/ status
to run git. How can we use magit in this situation? Thanks.
创建一个/path/to/worktree/.git包含内容gitdir: /path/to/gitdir并/path/to/gitdir/config设置core.worktree为/path/to/worktree. 您也可以使用相对路径。创建单独工作树的 Git 命令可以做到这一点(例如git submodule)。
/path/to/worktree/.git
gitdir: /path/to/gitdir
/path/to/gitdir/config
core.worktree
/path/to/worktree
git submodule
git worktree做了一些不同的事情,因为它必须支持多个工作树。但是根据您的用例,您也许可以只使用该命令而不是手动执行。
git worktree