如何将未提交的更改还原为git中某种类型的文件 [英] How to revert uncommitted changes to files of a certain type in git
本文介绍了如何将未提交的更改还原为git中某种类型的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的git储存库中有一堆修改过的文件,其中很大一部分是xml文件.如何仅还原xml文件的更改(重置修改)?
I have a bunch of modified files in my git repository and a large number of them are xml files. How do I revert changes (reset modifications) of only the xml files?
推荐答案
谢谢大家的答复,但对我来说,我找到了最准确的解决方案:
Thank you all for your replies, but I have found, for me, most accurate solution:
git diff --name-only -- '*.xml' | sed 's, ,\\&,g' | xargs git checkout --
sed是用户逃脱困扰xargs的空间,并且一切工作都非常快速准确.
sed is user to escape spaces which troubled xargs and everything is working very fast and accurate.
这篇关于如何将未提交的更改还原为git中某种类型的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文