Mellon
Mellon

Reputation: 38832

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?

Upvotes: 21

Views: 18844

Answers (4)

git reset -- FILE_NAME will do it.

See the git reset manual:

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

Upvotes: 41

Amol Udage
Amol Udage

Reputation: 3075

You can use git reset                

Upvotes: 2

eomeroff
eomeroff

Reputation: 9915

git stash save 
git stash apply 

they will all be unstaged

Upvotes: 4

Kit Ho
Kit Ho

Reputation: 26968

you could use

git reset --mixed -- <filename>

if you use --hard, you would discard all your changes.

Upvotes: 2

Related Questions