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

Re: Why does git-status suggest different commands to unstage files depending on whether there is a commit yet or not?

From
Anselm Schüler <mail@anselmschueler.com>
Date
Sep 16, 2025, 20:34 UTC
Message-ID
<de49d686-73fa-4bb9-9ec6-b65d5432a30a@anselmschueler.com>
In-Reply-To
<5036f7d8-8ac9-4f50-99af-5a3a2d1a07fc@anselmschueler.com>

Sorry for that. I apologise for the messed-up formatting. Let’s try that again.

—

After a new repository has been created, before a commit has been made, when files are staged, git-status suggests using git-rm to unstage files:

$ git status [...] No commits yet

Changes to be committed:
    (use "git rm --cached <file>..." to unstage)
[...]
After a commit has been made, git-status suggests using git-restore instead:
$ git status
[...]
Changes to be committed:
    (use "git restore --staged <file>..." to unstage)
[...]
Why is this the case?
Previous: Anselm SchülerNext: Junio C Hamano
Message 2 of 6 in “Why does git-status suggest different commands to unstage files depending on whether there is a commit yet or not?”
  1. Anselm SchülerSep 16, 2025
  2. Anselm SchülerSep 16, 2025
  3. Junio C HamanoSep 16, 2025
  4. D. Ben KnobleSep 16, 2025
  5. Junio C HamanoSep 17, 2025
  6. D. Ben KnobleSep 17, 2025

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.