How can I make alias that checks out branch from remote only if it exists. In other words, how can I suppress
If
<branch>
is not found but there does exist a tracking branch in exactly one remote (call it<remote>
) with a matching name, treat as equivalent to$ git checkout -b <branch> --track <remote>/<branch>
How am I reproducing this: lets say we have remote branch with the exact name branch/Name
but then(after fetch) I try to checkout branch with name branch/NAME
. What this does is it creates locally branch with the name branch/NAME
, but then we create remote branch with name branch/NAME
and now the confusion begins. All I want to do is make git checkout case sensitive. So if there is no branch with exact name in remote alias should simply fail with some sort of message or whatever.