简体   繁体   English

git,如何找到所有匹配的文件并恢复到以前的提交

[英]git, how to find all matching files and revert to previous commit

I have a long list of files in my commit that have been pushed up to the repo.我的提交中有很长的文件列表,这些文件已被推送到仓库。 I want to reset a set of those files back to a previous commit, but keep the changes I've made to the rest.我想将一组这些文件重置回之前的提交,但保留我对 rest 所做的更改。

For example:例如:

  • foldername1文件夹名称1
  • foldername3文件夹名称3
  • foldername4文件夹名称4

I want to revert the changes to all files (around 500 files) in foldername3 without having to do it manually for each file.我想恢复对 foldername3 中所有文件(大约 500 个文件)的更改,而不必为每个文件手动执行。

Just one folder, entire, no exceptions?只有一个文件夹,整个,没有例外? That's easy — checkout the folder from the previous commit:这很简单——签出上一次提交的文件夹:

gt checkout HEAD~ -- foldername3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM