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

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

From
Johannes Sixt <j6t@kdbg.org>
Date
Sep 18, 2025, 06:56 UTC
Message-ID
<42250bbc-95f1-4f15-825e-66fbafb0b061@kdbg.org>
In-Reply-To
<c28bff47-04ef-4568-8dc3-add99f52209a@anselmschueler.com>
Am 16.09.25 um 23:51 schrieb Anselm Schüler:
Show 6 quoted lines
> [...] I
> would’ve assumed git-rm simply removes the file and “writes” that
> removal to the staged changes. This seems to be what y’all are
> describing. But with that suggestion, I was confused, because I assumed
> git-rm there would be equivalent in some sense to git-restore in a
> repository with commits.

You seem to think that `git rm` removes a *change*. This leads me to believe that you think of commits as a set of *changes*. But this is the wrong mental model. A commit is a complete state of the project, and the index ("stage") is the complete project state that is going into the next commit. `git rm` removes a file, not a change.

-- Hannes
Previous: Chris Torek
Message 3 of 3 in “Fwd: 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. Chris TorekSep 17, 2025
  3. Johannes SixtSep 18, 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.