Open vzam opened 3 months ago
Hi,
can you explain more about it?
Sure, I can explain how it benefits myself. In my work, I am often interrupted by bugs, PR reviews and things that pop up with a higher priority and before I was using worktrees I had several copies of the repository to work on, such that I wouldn't have to create tons of WIP commits or stash the changes before changing to a different branch and topic. Worktree basically helps doing that, it is integrated into git
and it allows creating these copies of the repository on the fly, to work on a topic that comes up and be closed after the work was finished. It makes context switching much easier and allows to quickly jump into some code to look at with the colleagues. Compared to the approach of creating copies of the repository by hand, it shares the .git data and therefore to update all worktrees, you have to do only one fetch, you have the same .git configuration for all worktrees and you can quickly create and destroy those copies as necessary. The feature is documented here.
@vzam I don't use git worktree myself, but I know some people really like it for the reasons you mentioned.
As a user of git worktree, can you provide sketches, diagrams, or descriptions of how Gittyup might be modified/extended to accommodate users of the worktree workflow?
I will work something out and follow up with it, I need to familiarize myself better with the feature in git itself.
@jensenr30 I think it makes most sense to first implement the basic functionality of switching worktrees and improve from there, so here are my thoughts:
git worktree list
List details of each worktree. The main worktree is listed first, followed by each of the linked worktrees. The output details include whether the worktree is bare, the revision currently checked out, the branch currently checked out (or "detached HEAD" if none), "locked" if the worktree is locked, "prunable" if the worktree can be pruned by the prune command.
git_repository_open
does not support them and there seems to be no other function which is able to open the repository from a worktreebare
, locked
, prunable
as they could help troubleshooting
bare
flag is debatable, I think the app is not used in those contexts where bare repositories are usedmain
, show worktree/main
in collapsed state of the dropdown, where worktree
is the name of the current worktree or just /
(when the branch is on the main worktree of the repo). The name is the last directory of the path to the worktree, they are usually in the same directory. In case they are not, a tooltip could be shown on hover, containing the full path to the worktree.git_repository_open_from_worktree
prunable
(not there) or locked
(not always there, such as when on an external drive)Is that something that you can work with? After this is done, the next iteration could allow adding and removing worktrees.
Gittyup is great but it does not fit a workflow including
git worktree
very well. It would be great to see such a feature implemented.