DEV Community

Doge Algo Engineering
Doge Algo Engineering

Posted on • Updated on

How do I undo 'git add'?

Lets say we either did a git add <file-name> to stage a specific modified file or git add . to stage all the modified files.

We may consider git reset but we must do git reset only if we are trying to unstage "a change" in the file.

When we need to just unstage the file.

Good practice is,

if we done a git add <file-name>

Then the solution is git rm --cached

if we done a git add .

Then the solution is git rm -r --cached, as the git add . is recursive, we need to bring in the flag -r

Support Us: Buy Me a Cookie 🍪

Discussion (0)