Git:需要递归'git rm'所有bin和obj文件夹的内容 [英] Git: need to recursively 'git rm' the contents of all bin and obj folders
本文介绍了Git:需要递归'git rm'所有bin和obj文件夹的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
(大约有40个这样的文件夹)。我想在所有这些文件夹上执行
git rm -r
。有没有一个命令来做到这一点?
解决方案
有备份,
find。 -type d -name bin -exec git rm -r {} \;
找到。 -type d -name obj -exec git rm -r {} \;
更新
使用bash,你可以设置全球明星,并开心:
shopt -s globstar
git rm -r ** / {obj ,bin /
最后,如果您需要从存储库的历史记录中删除这些文件, git filter-branch
并从 '删除对象' /book/ch9-7.html#removing_objectsrel =nofollow noreferrer> Pro Git Book
Someone by accident just commited all of their bin and obj folders to our repo
(there are around 40 such folders). I would like to do a git rm -r
on all of these folders. Is there a command to do this?
解决方案
Have backups,
find . -type d -name bin -exec git rm -r {} \;
find . -type d -name obj -exec git rm -r {} \;
Update
With bash, you can set the shopt globstar, and be happy:
shopt -s globstar
git rm -r **/{obj,bin}/
Finally, if you need to remove these from the history of the repository, look at git filter-branch
and read the section on 'Removing Objects' from the Pro Git Book
这篇关于Git:需要递归'git rm'所有bin和obj文件夹的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文