Reputation: 25153
I have configured my .bash_aliases
like:
alias gc="git checkout"
alias gcf="git flow feature checkout"
source ~/.git-completion.bash
__git_complete gc _git_checkout
source ~/.git-flow-completion.bash
__git_complete gcf __git_flow_feature
But when I try to complete I should select checkout
and then I may select my branch:
$ gcf
checkout diff help publish rebase track
delete finish list pull start
$ gcf checkout a
a_branch1 a_branch2
What should I do that checkout
will be selected automatically when I write gcf
+aTAB
Upvotes: 2
Views: 156
Reputation: 1264
I think one solution might lie with custom Git alias completion:
If you use complex aliases of form
!f() { ... }; f
, you can use the null command:
as the first command in the function body to declare the desired completion style. For example!f() { : git commit ; ... }; f
will tell the completion to use commit completion. This also works with aliases of form!sh -c '...'
. For example,!sh -c ': git commit ; ... '
.
So you'll first need to set up a Git alias in your .gitconfig
:
[alias]
ffc = "!ffc() { : git checkout ; git flow feature checkout $@ ; } && ffc"
and then link it in .bash_aliases
:
alias gcf="git ffc"
It's untested but I think it'll do what you want. You might have some trouble with spacing in the $@
in the ffc
alias that \"$@\"
might fix depending on use case.
Upvotes: 3