Undo git add --all

GitGit Add

Git Problem Overview


I made a mistake and called git add -all, now all files are added. I did not make a commit and push. How can I undo my action?

Git Solutions


Solution 1 - Git

It has already been answered several times:

> You can use git reset. This will 'unstage' all the files you've > added after your last commit. > > If you want to unstage only some files, use git reset -- <file 1> > <file 2> <file n>. > > Also it's possible to unstage some of the changes in files by using > git reset -p.

See

Solution 2 - Git

To reset specific files you can use: git reset -- <file_a> <file_b> or to reset all your changes you can use git reset.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBendEgView Question on Stackoverflow
Solution 1 - GitSimone CarlettiView Answer on Stackoverflow
Solution 2 - GitnitishagarView Answer on Stackoverflow