Closed BrianKmdy closed 1 year ago
The basic idea is to create all worktrees at the same repository level. A simple solution is to use bare repositories or create a directory for your repository and keep all your worktrees there.
Am I missing something? Why would you want to specify a different path for your worktrees?
Right now I have all my repositories in d:/projects, I guess my concern would be if all of my active worktrees are also in d:/projects it would start to get kind of cluttered as I would have all of my repositories and worktrees mixed in the same project directory.
I was thinking it would be nice being able to store all worktrees for all projects in d:/projects/worktrees. But I could also look into your suggestions and try a bare repository or creating a subfolder that would include a repository and its worktrees.
My personal preference is to use bare repositories. That's what I recommend to people who use work trees.
I'm not sure how you would solve the problem that happens in the project directory by creating a directory of worktrees. You will end up creating multiple worktrees from multiple projects in the same directory.
I tried working with bare repositories but I think there's still a use case for specifying a worktree directory. My current workflow involves having a primary vscode window with all of my active projects. The issue I found with bare repositories is that it's a bit more complicated to set up and the directory name I'm adding to my workspace ends up being the name of a branch, i.e. "main". This makes it difficult to differentiate projects in that window.
I personally don't mind mixing and matching the worktrees from all my active projects into a single folder.
Hmm... If that's the case, I'll add a configurable property. When this property is defined, all worktrees will be created based on your path.
That would be awesome, thank you!
Hi @BrianKmdy,
Apologies for the delay!
The enhancement has been published v1.0.21
!
I would really like to know if this enhancement was what you were looking for.
Please test it when you are free and let me know about your experience.
Awesome, thank you @alexiszamanidis. I tested it out and it I'm able to store my worktrees in the folder now! One note which relates to this issue (https://github.com/alexiszamanidis/vscode-git-worktrees/issues/19) is that the worktree name doesn't include the project name, so if I had worktrees from multiple projects in that same folder there could be name collisions if they use the same branch name.
Thanks again for working on this!
To avoid name collisions, the format should look something like this:
[base-path]/[project-directory]/[worktree-name]
How does this sound to you?
That looks perfect to me
I added the enhancement.
I hope you like it!
I just tried it out - this is perfect, thank you! This is exactly what I was looking for.
You are welcome!
I'm glad you liked it.
Thank you for your time and contribution!
Is there a setting to specify where worktrees should be stored? I think it would be useful to have a directory somewhere out of the way to put all the active worktrees