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