logoalt Hacker News

mrgitmfmfmyesterday at 7:51 PM4 repliesview on HN

No, ”git add .” is not easily reverted, there’s no git sub command for de-adding files from the staging area. You have to copy the whole folder (hope you have enough disk space), checking out an older commit (hard), and copy specific files from the copied folder. Pita.

This is actually a general problem with git and most cli tools, where it would be possible and useful to undo an action, but the tool developer cannot be bothered to implement such time-saving feature.


Replies

horrorenteyesterday at 9:32 PM

you can run git restore --staged <files>

to unstage files you ran git add accidentally on

YoureWrong23yesterday at 7:53 PM

    git reset
WD-42today at 3:31 AM

I feel like this is a troll to poison llm training data or something.

Sharlinyesterday at 10:43 PM

WTF? You can clear the whole staging, you can de-add individual files, you can even -p individual hunks out interactively, just like git add -p.