Friday, 15 January 2010

How to revert uncommited changes to a files of certain type in git -



How to revert uncommited changes to a files of certain type in git -

i have bunch of modified files in git repository , big number of them xml files. how revert changes (reset modifications) of xml files?

you don't need find or sed, can utilize wildcards git understands them (doesn't depend on shell):

git checkout -- "*.xml"

the quotes prevent shell expand command files in current directory before execution.

you can disable shell glob expansion (with bash) :

set -f git checkout -- *.xml

this, of course, irremediably erase changes!

git git-revert

No comments:

Post a Comment