git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 0/2] completion of 'git [-C <dir>] checkout'

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 12, 2026, 01:45 UTC
Message-ID
<xmqqpkzoyuuh.fsf@gitster.g>
In-Reply-To
<B79E6047-CC44-42D0-A9CA-BF7B8D2C8B93@gmail.com>
Ben Knoble <ben.knoble@gmail.com> writes:
Show 17 quoted lines
>> Le 11 août 2026 à 00:04, Junio C Hamano <gitster@pobox.com> a écrit :
>> 
>> I did not, however, find any readily usable machinery in the
>> 'git-completion.bash' script that allows completing a path within an
>> arbitrary tree.  If such machinery were available, 'git checkout
>> other-branch foo<TAB>' could capture the output of 'git ls-tree -r
>> other-branch' and offer paths that begin with the given prefix.
>> 
>> Regardless, implementing this is beyond my 'git-completion-fu' right
>> now.  As I mentioned, I barely managed the 'diff' completion as a
>> monkey-see-monkey-do patch series, and I would welcome others
>> building on top of this once the dust settles.
>
> I do not know where it lives (and it may be Zsh-specific) [partly
> because I haven’t looked while on mobile], but I think there is
> support for completing « path » in « git show <tree>:», so there
> might be something to build on there.

I know where treeish:path<TAB> support is. The thing is, it is not a reusable machinery for "git checkout treeish path<TAB>".

Thanks.
Previous: Ben KnobleNext: Junio C Hamano
Message 8 of 19 in “completion of 'git [-C <dir>] checkout'”
  1. 0/2 completion of 'git [-C <dir>] checkout'Junio C Hamano, Aug 11, 2026
  2. 1/2 completion: no-op refactoring of checkout completionJunio C Hamano, Aug 11, 2026
  3. 2/2 completion: complete tracked paths for "git checkout"Junio C Hamano, Aug 11, 2026
  4. Ben KnobleAug 11, 2026
  5. Junio C HamanoAug 11, 2026
  6. Junio C HamanoAug 11, 2026
  7. Ben KnobleAug 11, 2026
  8. Junio C HamanoAug 12, 2026
  9. 0/3 completion of 'git [-C <dir>] checkout'Junio C Hamano, Aug 12, 2026
  10. 1/3 completion: no-op refactoring of checkout completionJunio C Hamano, Aug 12, 2026
  11. 2/3 completion: complete tracked paths for "git checkout"Junio C Hamano, Aug 12, 2026
  12. 3/3 completion: 'git checkout' completes untracked paths as a last resortJunio C Hamano, Aug 12, 2026
  13. Elijah NewrenAug 12, 2026
  14. Junio C HamanoAug 12, 2026
  15. 0/3 completion of 'git [-C <dir>] checkout'Junio C Hamano, Aug 13, 2026
  16. 1/3 completion: no-op refactoring of checkout completionJunio C Hamano, Aug 13, 2026
  17. 2/3 completion: complete tracked paths for "git checkout"Junio C Hamano, Aug 13, 2026
  18. 3/3 completion: 'git checkout' completes untracked paths as a last resortJunio C Hamano, Aug 13, 2026
  19. Elijah NewrenAug 14, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.