Git:需要递归地“git rm”;所有 bin 和 obj 文件夹的内容
有人不小心将所有 bin 和 obj 文件夹提交到我们的存储库 (大约有 40 个这样的文件夹)。我想做一个git rm -r
在所有这些文件夹上。有命令可以执行此操作吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
进行备份、
更新
使用 bash,您可以设置 shopt globstar,并感到高兴:
最后,如果您需要从存储库的历史记录中删除这些内容,请查看 git filter-branch 并阅读 部分Pro Git Book< 中的“删除对象” /a>
Have backups,
Update
With bash, you can set the shopt globstar, and be happy:
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一旦您恢复(将文件保留在历史记录中)或重置提交,
一旦这些文件被忽略,
我就会在重建解决方案之前使用它来清理。即使在签出不同的分支或合并之后,VS 似乎也会使用一些 dll。
您不需要诉诸过滤分支。交互式变基就可以了。请记住 --preserve-merges 标志。
希望这有帮助。
Once you revert (will keep files in history) or reset the commit,
Once these are ignored files,
I use that to clean up before rebuilding a solution. Seems vs uses some dlls even after a checkout of a different branch or a merge.
You shouldn't need to resort to filter branch. Interactive rebase will do. Remember the --preserve-merges flag.
Hope this helps.
另一种选择是使用 git revert 恢复有问题的提交。
Another option is to revert the offending commit with
git revert
.