Re: Shell completion for branch names
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 7, 2021, 19:52 UTC
- Message-ID
- <xmqqr1jlzxc5.fsf@gitster.g>
- In-Reply-To
- <MXghkzC----2@tutanota.com>
jost.schulte@tutanota.com writes:
Show 8 quoted lines
> I have a question regarding git-completion. I'm using zsh and have > added the function .git-completion.bash. That gives me some > auto-completion for branch names. > > What I'm looking for: I have a branch named > "feature/issue-123-add-feature" for example. I'd like to type "git > switch 123[tab]". Is there some function out there that provides > this?
I am not an area expert for shell completion, but as a mere user, unless the shell completion in a directory where I have README.txt file, responds to
$ cat EAD<TAB>
and completes the request to
$ cat README.txt
I would find such a behaviour quite confusing.
On the other hand if
$ git log feat<TAB>
expands to
$ git log feature/issue-
then another <TAB> after that would offer 123-add-feature and 143-fix as candidates, or instead of <TAB> if I type "123<TAB>" and get it expanded to the full feature/issue-123-add-feature, then I wouldn't find it confusing or unnatural.