mykolaharmash / git-jump

Improved navigation between Git branches.
MIT License
202 stars 6 forks source link

Errors from the initial git switch are not displayed for a direct jump mode in case branch name is incorrect #7

Open mykolaharmash opened 2 years ago

mykolaharmash commented 2 years ago

When switching into a branch using git jump <branch-name> and git could not make a switch (for example you have uncommitted changes), git-jump won't display an error message from the native git switch in case <branch-name> does not fuzzy-match any of the local branches.

git-jump will say <branch-name> does not match any branch, which might be confusing in case there is such branch but it's remote. In this case, there is an underlying error that prevents a switch, but git-jump never shows it.

See jumpTo() function.

The core issue here is that git-jump tries native git switch with all provided arguments first and, if that fails, assumes there is no exact match for the provided branch name and proceeds to fuzzy-search. While in fact there might be some other errors not related to the branch name. Also, at the point when git-jump goes to fuzzy search, it drops all the other arguments and uses only the first one, which is also unintuitive.

A holistic solution would be: