The first positional argument to git switch can be a branch, e.g. git switch <branch> and it tab completes nicely.
How can I make my own command with an argument that can tab complete into a git branch?
For
git banana [--optional-option] <branch>to tab complete, it does not seem to be enough to bash builtincomplete -Fas that would not necessarily include "banana". And also I want to amend the completions forgit, not overwrite it.Does git have some subcommand or shell functions to help with this?
I found
__gitcompbut not sure how to use it- together with an alias
- specifically to trigger for the 1st positional argument