-
Notifications
You must be signed in to change notification settings - Fork 6
Description
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:
- Use fuzzy-search only when there is one argument provided, in all other cases use
git switch
straight away. This will be a more predictable behavior and will match the interactive mode, where you also cannot provide any arguments when switching into a branch. - Update README to describe the distinction between
git jump <branch-name>
which will use fuzzy-search andgit jump <branch-name> [options]
which will usegit switch
directly without fuzzy-search.