简体   繁体   English

如何git rm仓库中已删除的所有文件,不包括其他文件

[英]How to git rm all deleted files from repo, excluding others

I have used this post Removing multiple files from a Git repo that have already been deleted from disk to figure out how to remove multiple files with git rm at once. 我曾经用过这篇文章, 从Git存储库中删除了多个文件,这些文件已经从磁盘删除,以弄清楚如何使用git rm一次删除多个文件。

Now, I'd like to do this, excluding one directory. 现在,我想执行此操作,但不包括一个目录。 I tried this: 我尝试了这个:

git rm $(git ls-files --deleted --exclude='sites/all/modules/imagecache_actions/')

but it didn't work. 但这没用。 Am I misusing the exclude tag? 我在滥用排除标签吗?

git ls-files -d | sed '/^sites\/all\/modules\/imagecache_actions\//d' | xargs git rm

-x --exclude选项仅适用于未跟踪的文件。

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

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