我试图递归地删除文件扩展名,但无论我尝试什么,它都会失败。谢谢你的任何想法。
ubuntu@ubuntu-laptop:~/hh/hh_sdk/src/uboot_hh$ git rm -r --cached \*.o
fatal: pathspec 'src/uboot_hh/*.o' did not match any files
ubuntu@ubuntu-laptop:~/hh/hh_sdk/src/uboot_hh$ sudo git rm -r --cached \*.o
fatal: pathspec 'src/uboot_hh/*.o' did not match any files
ubuntu@ubuntu-laptop:~/hh/hh_sdk/src/uboot_hh$ sudo git rm -r --cached *.o
fatal: pathspec 'src/uboot_hh/*.o' did not match any files
ubuntu@ubuntu-laptop:~/hh/hh_sdk/src/uboot_hh$ sudo find . -name *.o -exec git rm -r --cached {} \;
fatal: pathspec 'src/uboot_hh/lib_arm/_divsi3.o' did not match any files
fatal: pathspec 'src/uboot_hh/lib_arm/cache.o' did not match any files
fatal: pathspec 'src/uboot_hh/lib_arm/_udivsi3.o' did not match any files
fatal: pathspec 'src/uboot_hh/lib_arm/_umodsi3.o' did not match any files
The find
方法应该可以很好地工作,但是您需要单引号'*.o'
模式,因为 shell 会扩展*
在将其传递给之前find
.
您还需要通过--force
选项 (-f
) to git rm
如果文件系统中不再存在该文件:
find -name '*.o' -exec git rm -f -r --cached {} \;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)