Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undo git add --all [duplicate]

Tags:

git

git-add

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?

like image 620
BendEg Avatar asked Jan 18 '15 15:01

BendEg


People also ask

How do you undo a git add all?

To undo git add before a commit, run git reset <file> or git reset to unstage all changes.

How do I undo git add After commit?

Undoing a commit If you have modified, added and committed changes to a file, and want to undo those changes, then you can again use git reset HEAD~ to undo your commit.


1 Answers

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

  • How to undo 'git add' before commit?
  • How can you undo the last git add?
like image 89
Simone Carletti Avatar answered Sep 23 '22 05:09

Simone Carletti