Mellon Mellon - 9 months ago 55
Git Question

GIT add revert in my case (keep changes)

After I made changes on a file. I use

git add FILE_NAME

Then, I would like to revert it as not added but meanwhile keep the changes, how to do this?

Answer Source

git reset -- FILE_NAME will do it.

See the git reset manual:

This form resets the index entries for all <paths> to their state at <commit>. (It does not affect the working tree, nor the current branch.)

This means that git reset <paths> is the opposite of git add <paths>.