3 ms·
`git add <file>` Wait, how do I remove it from staging? It seems there should be some symmetric operation, `git remove <file>` or something. Maybe git rm `<f
by rileymat2 5y ago
`git add <file>`
Wait, how do I remove it from staging? It seems there should be some symmetric operation, `git remove <file>` or something. Maybe git rm `<file>`, whoa don't do that.
No, it is `git reset HEAD -- <file>`. There is no mental symmetry.
Or why use add at all? What am I adding it to? It is so generic, why not `git stage file` and `git unstage file`?
I agree that you need to read and learn tools, but there is a lack of consistency and symmetry in many of the commands which make it harder.
- cerved 5y agoIt may not be the most mnemonic but it clearly says right in the CLI what you're supposed to do (use "git restore --staged <file>..." to unstage)
- rileymat2 5y agoIt looks like I get that message when I do a git status, not the git add. Also, it looks like "restore" was not added until august 2019. And I have not used it, but will in the future! But this does not exactly help the conceptual issues, because now we have `git revert`, `git reset`, and `git restore`. From an english concept perspective those words are all very similar in meaning.