Skip to content

fix(MORG-52): avoid checkout to base when starting from a worktree branch#44

Merged
developerdavi merged 1 commit intomainfrom
MORG-52
Mar 10, 2026
Merged

fix(MORG-52): avoid checkout to base when starting from a worktree branch#44
developerdavi merged 1 commit intomainfrom
MORG-52

Conversation

@developerdavi
Copy link
Owner

Ticket

MORG-52: Can't start a new branch from a worktree branch

Summary

  • When on a worktree branch, morg start <new> was trying to git checkout main before creating the new branch — this fails because main is already checked out in the main worktree
  • Applied the same pattern used in MORG-48 (sync.ts): use fetchAndUpdateBranch(base) to update the local ref without any checkout
  • New branch is now created with checkout(name, true, base)git checkout -b name base, so it always starts from the correct base ref regardless of which branch is currently active

Test plan

  • From a worktree branch, run morg start <new-branch> — should create the branch without trying to checkout main
  • From main (non-worktree), morg start <new> still pulls main then creates the branch as before

…tree

When on a worktree branch and running `morg start <new>`, the previous code
tried to `git checkout <base>` which fails because the base is already
checked out in the main worktree.

Use `fetchAndUpdateBranch(base)` to update the local ref without checking out,
then create the new branch explicitly from that ref via `checkout(name, true, base)`.
@developerdavi developerdavi merged commit 1426832 into main Mar 10, 2026
1 check passed
@developerdavi developerdavi deleted the MORG-52 branch March 10, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant