Dev Notes

Software Development Resources by David Egan.

Undo a Git add


Git
David Egan

git add Adds file contents to the index - preparing the content staged for the next commit.

The “index” holds a snapshot of the content of the working tree, and it is this snapshot that is taken as the contents of the next commit.

git docs

Before running the commit command, you use add to add new/modified files to the index.

It’s common that you accidentally add a file - and it can be very important to remove it again.

Remove a Single File

To remove a given file only from the current index:

git reset filename

Undo git add Althogether

git reset

comments powered by Disqus