Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
January 29, 2022 02:14 pm GMT

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 Book


Original Link: https://dev.to/danyson/how-do-i-undo-git-add-5c6e

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To