-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Refines 'Create Worktree' Flow #3559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Auto-chooses "for new branch" option or not based on whether the chosen branch is already in a worktree. - If "new branch" option is chosen, shows prompt for new branch name before reaching the confirm step.
To test:
|
Re testing scenario no-1. I'm not sure that I get it correctly. I see the same behavior in pre-release. It creates and opens a worktree without a question: open-worktree-without-a-question.mp4 |
@sergeibbb in your screen share, you are using "Open in Worktree". These changes are for "Create Worktree" and should not affect the "Open in Worktree" flow. |
@axosoft-ramint Same for create: create-worktree-without-a-question.mp4Re test scenario 2. I confirm that I see the difference: |
It looks to be functioning correctly, with expected behavior for scenario 1, based on your screenshare. In the case of "create worktree" for a branch that is not already on a worktree, we now default to a single confirmation option, "create worktree for branch", rather than offering two options (the other being "create worktree for new branch named..."). The default option just creates a worktree for that branch, with its name, and then lets you choose how to open it. In the case of "create worktree" for a branch that is already on one (i.e. scenario 2), we also have the same single confirmation option (create worktree for branch) which will let you choose a name for a new branch to create and will create a worktree on that new branch. It will function just like the "create worktree for new branch named..." option did before. |
@axosoft-ramint |
@sergeibbb I apologize - my description of expected behavior in that scenario is completely wrong. It should work like scenario 1 after using "Create branch in New Worktree". It should offer "Create Worktree for Branch" which just creates the worktree for the new branch you have created. My apologies again - I will update the description of the steps. Thanks for testing it! |
Re 4: It does not create the local branch: does-not-create-local-branch.mp4 |
@axosoft-ramint
Ah, I see. it has replaced "Create worktree for new branch named" with a "create worktree for branch". Now I see it. But it behaves identically. In both cases (main and feature branch) I come to the same result: a worktree for a new branch named after it. |
Yes, this one is mainly a naming change because the previous naming of the option for creating a worktree after creating the branch was confusing. |
This looks like a bug. I will investigate. Thanks for catching it! |
@sergeibbb I have fixed case 4 (and a separate bug with case 3 where it does not create the new branch). Would you mind testing all four cases once more? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I confirm. #.4 fixed |
scenario 2 works well. |
Good catch. This is an existing issue that this PR does not address, and we should write a follow-up ticket to fix it. Since it's not a new issue introduced by these changes, I will merge them for now. |
Closes #3542
Automatically chooses the
-b
flag or not based on if your chosen branch is already in a worktree.Also, if the
-b
flag does apply, shows the "new branch name" prompt before the confirm step.