sublime_merge icon indicating copy to clipboard operation
sublime_merge copied to clipboard

Add support for managing worktrees

Open CheyenneWills opened this issue 5 years ago • 12 comments

Problem description

There are no direct facilities (tools, menus or keybindings) for managing worktrees.

It appears that the SM is already aware of worktrees in that a worktree shows in the "Locations" panel of a repository, but there is not an indicator that it is a worktree)

Preferred solution Provide basic tools for performing worktree operations.

  • add
  • move
  • lock
  • unlock
  • prune
  • remove

In the "Locations" panel have some indicator that an "object" is a worktree

Add the ability to open a worktree in a new tab as an right click option on the "object" from the "Locations" panel.

CheyenneWills avatar May 28 '20 15:05 CheyenneWills

Actually I might missunderstand @CheyenneWills part '..a worktree shows in the "Locations" panel...' because I don't see it at all. But generally an integration of worktrees would be sweet.

themilkman avatar Mar 26 '21 10:03 themilkman

Good support for git worktrees would be really great feature and would also be a unique selling point for Sublime Merge! 👍🏼

teameh avatar Apr 13 '21 17:04 teameh

Yes, as a holder of a license of Sublime Merge (SM), I became a bit disappointed to realize that it does not handle worktrees. As @themilkman mentioned, I do not see anything that shows that SM recognizes a worktree. I also commented it in SM forum, someone told it did support it, which is not true.

A reference a found: https://forum.sublimetext.com/t/sublime-merge-cannot-open-git-worktree/39096

The item I posted: https://forum.sublimetext.com/t/how-does-worktree-work-in-sublime-merge/59011

nephewtom avatar Aug 15 '21 23:08 nephewtom

Well, you can actually work with worktrees, but opening/creating/deleting is not supported via UI.

Generally I am also not sure how "stable" git worktrees are considered by git itself.

Moreover I have the impression that some users are confused by the official git wording and think of the currently checked out repository, not the actual "new" git worktree feature when writing. But I could be wrong on that.

themilkman avatar Aug 16 '21 05:08 themilkman

What do you mean by "you can actually work with worktrees"? I could work with the worktree I created, but using git commands on the terminal not via SM. SM didn't recognize the worktree, neither helped me with the files diffs (I know, I know, UI is not supported). So I can't see how SM can actually work with worktrees or help with them... It basically gives zero help. BTW, my environment is WSL on Windows 10.

nephewtom avatar Aug 16 '21 07:08 nephewtom

Ouh okay, for me it works as any other git repository (aka I can do anything inside, only no UI). Kubuntu 21.04 here.

themilkman avatar Aug 16 '21 07:08 themilkman

I was having issues because I develop under WSL and was using SM for Windows. If I use SM for WSL (from Linux apt repo) it works. SM handles worktrees opening them in a different tab.

I would prefer SM for Windows to handle also WSL stuff, since I prefer to use OS native tools. But I get that would need extra work to handle WSL paths and all that stuff.

nephewtom avatar Aug 16 '21 11:08 nephewtom

Using worktrees to keep several projects running in a large repo where switching branches takes 3-4 minutes is beneficial. I use SM all the time, been licensed since day 1. I'd love better support for this feature, even if it's just opening that worktree branch in a new tab.

ckaminski avatar Jun 17 '22 18:06 ckaminski

👍

I use SM as my daily driver. I use VSCode and GitLens+ has support for worktrees. Now that I created a worktree for master and other branches, I am getting the error described over here: https://github.com/sublimehq/sublime_merge/issues/1347 Can't SM detect if a git repo is using worktrees and then know to switch the branch pointer or something? I'd love to not have to dance around this incompatibility. Also, I'm a paid user.

samholmes avatar Nov 28 '22 22:11 samholmes

neovim anyone? :-D

maddanio avatar Apr 26 '23 11:04 maddanio

I notice in the latest build that in my repo with submodules that if I click on said submodule SM will open that repo in a new tab.

A simple fix to add support would be to a worktree section in the branches sidebar, and double clicking said worktree would open that worktree in a new tab.

Then some repository menu options or right click options to manage worktreees.

This is the last major feature I need the git-cli for.

ckaminski avatar Feb 28 '24 16:02 ckaminski

I notice in the latest build that in my repo with submodules that if I click on said submodule SM will open that repo in a new tab.

A simple fix to add support would be to a worktree section in the branches sidebar, and double clicking said worktree would open that worktree in a new tab.

Then some repository menu options or right click options to manage worktreees.

This is the last major feature I need the git-cli for.

What I see lacking still is the ability to manage worktrees (e.g. creating them, removing them, etc.). If I manually create a worktree, SM is able to use the worktree just like any other git repo.

CheyenneWills avatar Feb 28 '24 20:02 CheyenneWills