Skip to content

GitUp leaves behind many incorrectly modified files when checkout of HEAD branch from alternate worktree fails (as expected) #2713

@matthewhively

Description

@matthewhively

I have a project where I have 2 worktrees on the same repo.
I often forget which branch I have checked out in the alternate worktree.
So when I use GitUp to switch branches, sometimes I'll receive the error:

Image

This is fine and expected (if a little more cryptic than the git CLI would print) fatal: '<branch>' is already checked out at '<location>'

However, unfortunately when this happens GitUp also leaves a bunch of erroneously modified files left behind that have to be cleaned up.

Image

These staged changes contain what would be a "revert" against the other branch's HEAD.

A similar issue happens sometimes when a merge fails, or a rebase fails, but its probably the same piece of code.

This behavior does not happen when an attempted checkout fails from the git cli. It just prints the quoted error message and no code is left in a weird state.

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