Skip to content

syncing a branch with deleted remote tries to check out main even if that is in another worktree #5797

@kevgo

Description

@kevgo

Steps to reproduce

  • Have a repo with this lineage:

    main
     \
      feature-1
     \
      feature-2
    
  • Check out feature-1

  • Check out main in another branch

  • delete the remote of feature-1 at the remote

  • run git sync

Command output

[feature-1] git fetch --prune --tags
From /tmp/13703270/result_1/origin
 - [deleted]         (none)     -> origin/feature-1

[feature-1] git checkout main
fatal: 'main' is already used by worktree at '/tmp/13703270/result_1/development_worktree'


Error: cannot check out branch "main": exit status 128

To continue after having resolved conflicts, run "git town continue".
To go back to where you started, run "git town undo".
To continue by skipping the current branch, run "git town skip".

Additional information

  • it should check out feature-2
  • if there is no branch to check out, it should tell me that

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions