Is there a good reason why working trees should be created at the same directory hierarchy level as the git repo?

458 views Asked by At

When I went through many tutorials related to git worktree, everywhere in the command which was used to demonstrate the creation of worktree, .. was used for the path where the working tree should be created - which indicates that the new working tree directory to be created at the same directory hierarchy level as that of the git repo.

An example taken from the git website

git worktree add -b emergency-fix ../temp master

And another from Atomic Object-

git worktree add ../new-worktree-dir some-existing-branch

So I am wondering is there a good reason to create worktree at the same directory hierarchy as the git repo?

Technically, you can create the working tree inside the git repo also. Git allows it.

And I feel creating all the worktree belonging to a particular git repo under the git repo directory would give a logical grouping.

git worktree add -b emergency-fix ./temp master
0

There are 0 answers