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

BUG: cannot remove new staged files in sparse checkout

From
EEErik Cervin Edin <erik@cervined.in>
Date
Apr 6, 2022, 12:51 UTC
Message-ID
<CA+JQ7M-Haf3R8xp-sqyJXPZza3VeaRf9uK=tyuviNFVZ0kdBTw@mail.gmail.com>
Hi friends!
I've stumbled across what I believe is a bug
I've found myself with new files that are staged, not part of the
sparse-checkout, that I cannot unstage using git restore --staged, ie
  git restore --staged :\
does nothing.
I'm able to get rid of the using
  git stash && git stash drop
but intuitively I would expect restore --staged to work, even if the
files are not part of the sparse checkout
I end up in this peculiar situation by doing the following.
Having branches:
  foo/bar
  origin/foo
and then running
  git switch -c foo
Updatings files: 100% (X/X) done.
fatal: cannot lock ref 'refs/heads/foo': 'refs/heads/foo/bar' exists;
cannot create 'refs/heads/foo'
Next: Erik Cervin Edin
Message 1 of 2 in “BUG: cannot remove new staged files in sparse checkout”
  1. Erik Cervin EdinApr 6, 2022
  2. Erik Cervin EdinApr 6, 2022

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.