3

If git-dir is not in work-tree, we can use the command line

git --work-tree=/a/b --git-dir=/c/d/ status

to run git. How can we use magit in this situation? Thanks.

Jay
  • 9,585
  • 6
  • 49
  • 72
user3208
  • 155
  • 3

1 Answers1

3

Create a file /path/to/worktree/.git with contents gitdir: /path/to/gitdir and in /path/to/gitdir/config set core.worktree to /path/to/worktree. You can also use relative paths. Git commands which create separate worktrees do that (e.g. git submodule).

git worktree does something a bit different because it has to support multiple worktrees. But depending on your use-case, you might be able to just use that command instead doing it manually.

tarsius
  • 8,147
  • 5
  • 32
  • 46
  • By the way, for questions about Magit and other Emacs related things I recommend http://emacs.stackexchange.com. – tarsius Dec 09 '15 at 10:40