Git - 递归删除文件扩展名
我试图删除递归的文件扩展名,但它保持失败,无论我试图。感谢您的任何想法。Git - 递归删除文件扩展名
[email protected]:~/hh/hh_sdk/src/uboot_hh$ git rm -r --cached \*.o
fatal: pathspec 'src/uboot_hh/*.o' did not match any files
[email protected]:~/hh/hh_sdk/src/uboot_hh$ sudo git rm -r --cached \*.o
fatal: pathspec 'src/uboot_hh/*.o' did not match any files
[email protected]:~/hh/hh_sdk/src/uboot_hh$ sudo git rm -r --cached *.o
fatal: pathspec 'src/uboot_hh/*.o' did not match any files
[email protected]:~/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
的find
方法应该工作得很好,但你需要单引号的'*.o'
模式,因为外壳,否则将它传递给find
之前扩大*
。
还需要将--force
选项(-f
)传递给git rm
如果文件不存在于文件系统中存在了:
find -name '*.o' -exec git rm -f -r --cached {} \;
谢谢,我完全按照你的写法来尝试,但是我仍然感到致命:pathspec'src/linux/linux-04.02.00.07/mm/vmalloc.o'与任何文件都不匹配 fatal:pathspec'src/linux/linux -04.02.00.07/mm/madvise.o'没有匹配任何文件 ...... 而且我仍然在git gui中看到这些文件“作为未知变化 – ransh 2014-09-01 15:46:57
输出是什么:'find -name'* .o'-exec bash -c'file = {}; echo“$ file”; git rm -f -r --cached“$ file”;' \;'? – hek2mgl 2014-09-01 15:52:59
嗨,它仍然是一样的 – ransh 2014-09-01 18:41:22
是任何你'.o'文件通过实际的Git跟踪? – 2014-09-01 08:29:22