Sublime Forum

How does worktree work in Sublime Merge


Just started using git worktree and do not get how Sublime Merge integrates with it.

I am currently doing some work on a feature branch of my repo and executed:
git worktree add ../develop develop
to continue some other development in main develop branch not associated with the feature one.

So now I have two directories each one on a different branch:

~/my-project/develop  [branch develop]
~/my-project/repo     [branch feature-x]

I do not see anything on Sublime Merge UI for worktree, which I find coherent.
But if I try to load via File | Open Repository and select the develop path, I get a Windows Dialog with the text:

~/my-project/develop doesn’t look like a git repository.

That message kind of matches with this other thread:

Is git worktree already supported in Sublime Merge?
If so, how does it work?
By the way, I have a paid license.

Best Regards.



I just tried it and opened a worktree repo here, it works for me as it did before (kubuntu 21.04).
On the “normal” terminal the git wt works for you (e.g. output of git worktree list)? Are there maybe any logs in the SM-console?

Not that this really related to your problem, but generally, I’d also love to see a better integration of worktrees, see github issue 757



Yes, git worktree list works fine.
But I see nothing related to worktrees in SM’s Locations panel…
I am on Windows 10 with build 2056, which is the latest.

And nothing is displayed in SM-console.
I just get the mentioned Dialog when trying to open the directory that belongs to the worktree I created.



Ok, probably you should also file an issue then:

This is because there is no “git worktree” integration in SM yet (see the mentioned issue)



By the way, this might be the reason it pops the Windows Dialog…
I am currently working with WSL on Windows 10.
The .git in the worktree directory it is not a directory, neither a symlink, but a text file…

$ file repo/.git
repo/.git: directory

$ file develop/.git
develop/.git: ASCII text

$ cat develop/.git
gitdir: /mnt/c/Users/nephewtom/my-project/repo/.git/worktrees/develop