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

Automagic `git checkout branchname` mysteriously fails

From
Martin Langhoff <martin.langhoff@gmail.com>
Date
Oct 14, 2016, 20:25 UTC
Message-ID
<CACPiFC+8+wVEcDt9JZgTW1dwCCFKszyXD6ysDxNQorcNkom7Lw@mail.gmail.com>
In a (private) repo project I have, I recently tried (and failed) to do:
  git checkout v4.1-support
getting a "pathspec did not match any files known to git" error.

There's an origin/v4.1-support, there is no v4.1-support "local" branch. Creating the tracking branch explicitly worked.

Other similar branches in existence upstream did work. Autocomplete matched git's own behaviour for this; where git checkout foo woudn't work, autocomplete would not offer a completion.

Why is this?

One theory I have not explored is that I have other remotes, and some have a v4.1-support branch. If that's the case, the error message is not very helpful, and could be improved.

git --version 2.7.4

DWIM in git is remarkably good, even addictive... when it works :-)
cheers,
m
-- 
 martin.langhoff@gmail.com
 - ask interesting questions  ~  http://linkedin.com/in/martinlanghoff
 - don't be distracted        ~  http://github.com/martin-langhoff
   by shiny stuff
Next: Kevin Daudt
Message 1 of 4 in “Automagic `git checkout branchname` mysteriously fails”
  1. Martin LanghoffOct 14, 2016
  2. Kevin DaudtOct 14, 2016
  3. Martin LanghoffOct 14, 2016
  4. Duy NguyenOct 17, 2016

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.