emacs magit: git-dir 不在默认位置
emacs magit: git-dir is not in the default place
如果git-dir
不在工作树中,我们可以使用命令行
git --work-tree=/a/b --git-dir=/c/d/ status
到运行git。在这种情况下我们如何使用 magit 呢?
谢谢
创建一个包含内容 gitdir: /path/to/gitdir
的文件 /path/to/worktree/.git
,并在 /path/to/gitdir/config
中将 core.worktree
设置为 /path/to/worktree
。您也可以使用相对路径。 Git 创建单独工作树的命令(例如 git submodule
)。
git worktree
做了一些不同的事情,因为它必须支持多个工作树。但根据您的用例,您也许可以只使用该命令而不是手动执行。
如果git-dir
不在工作树中,我们可以使用命令行
git --work-tree=/a/b --git-dir=/c/d/ status
到运行git。在这种情况下我们如何使用 magit 呢? 谢谢
创建一个包含内容 gitdir: /path/to/gitdir
的文件 /path/to/worktree/.git
,并在 /path/to/gitdir/config
中将 core.worktree
设置为 /path/to/worktree
。您也可以使用相对路径。 Git 创建单独工作树的命令(例如 git submodule
)。
git worktree
做了一些不同的事情,因为它必须支持多个工作树。但根据您的用例,您也许可以只使用该命令而不是手动执行。