git - How to undo local changes to a specific file -


i'm trying undo local changes specific file. nothing has been committed.

when want revert changes, can perform git revert --reset head. however, in case, don't want revert changes files.

its not clear or obvious me how revert file, after reading git-revert(3) man page:

name        git-revert - revert existing commits  synopsis        git revert [--[no-]edit] [-n] [-m parent-number] [-s] <commit>...        git revert --continue        git revert --quit        git revert --abort ... 

this similar how revert specific file in old commit on git, no commits have been performed. , unlike op, wants go arbitrary commit, want file return master's copy of it.

under svn, delete file in question , perform svn update.

how revert changes single file?

you don't want git revert. undoes previous commit. want git checkout git's version of file master.

git checkout -- filename.txt

in general, when want perform git operation on single file, use -- filename.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -