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

Re: [PATCH] completion: optionally disable checkout DWIM

From
Jacob Keller <jacob.keller@gmail.com>
Date
Apr 21, 2017, 07:25 UTC
Message-ID
<CA+P7+xr83+sGiRcfbmAvOGzxoR+BMVsjED41JY5P15Dw1qVb+w@mail.gmail.com>
In-Reply-To
<20170420201229.fxiylgp2v2v4sz3w@sigill.intra.peff.net>
On Thu, Apr 20, 2017 at 1:12 PM, Jeff King <peff@peff.net> wrote:
Show 35 quoted lines
> When we complete branch names for "git checkout", we also
> complete remote branch names that could trigger the DWIM
> behavior. Depending on your workflow and project, this can
> be either convenient or annoying.
>
> For instance, my clone of gitster.git contains 74 local
> "jk/*" branches, but origin contains another 147. When I
> want to checkout a local branch but can't quite remember the
> name, tab completion shows me 251 entries. And worse, for a
> topic that has been picked up for pu, the upstream branch
> name is likely to be similar to mine, leading to a high
> probability that I pick the wrong one and accidentally
> create a new branch.
>
> This patch adds a way for the user to tell the completion
> code not to include DWIM suggestions for checkout. This can
> already be done by typing:
>
>   git checkout --no-guess jk/<TAB>
>
> but that's rather cumbersome. The downside, of course, is
> that you no longer get completion support when you _do_ want
> to invoke the DWIM behavior. But depending on your workflow,
> that may not be a big loss (for instance, in git.git I am
> much more likely to want to detach, so I'd type "git
> checkout origin/jk/<TAB>" anyway).
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> This is flexible enough for me, but it's possible somebody would want
> this on a per-repo basis. I don't know that we want to read from `git
> config`, though, because it's relatively expensive to do so. People who
> want per-repo settings are probably better off with a hook that triggers
> when they "cd" around, and sets up their preferences.
>

I would use this. Completing these can get quite cumbersome to use when I have only a few local branches but many remote ones like in git.git

Thanks, Jake

Previous: SZEDER GáborNext: Jeff King
Message 8 of 10 in “completion: optionally disable checkout DWIM”
  1. completion: optionally disable checkout DWIMJeff King, Apr 20, 2017
  2. Junio C HamanoApr 21, 2017
  3. Jeff KingApr 21, 2017
  4. Junio C HamanoApr 21, 2017
  5. SZEDER GáborApr 21, 2017
  6. Jeff KingApr 21, 2017
  7. SZEDER GáborApr 22, 2017
  8. Jacob KellerApr 21, 2017
  9. completion: optionally disable checkout DWIMJeff King, Apr 21, 2017
  10. Brandon WilliamsApr 24, 2017

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.