我正在使用BFG删除我的两个文件夹。从回购协议开始就对其进行了跟踪。删除的原因是那些文件夹包含我们不再需要的二进制文件和其他txt文件。但是,当我尝试删除这两个文件夹时,其中一个被删除,但另一个仍在徘徊。
我创建了虚拟仓库,并做了一些提交来重新创建问题。我假设myRepo.git是干净的仓库。
我用来删除文件夹的功能是: java -jar bfg-1.13.0.jar --no-blob-protection --delete-folders "{system1, system2}" myRepo.git
#!/bin/bash
BUILD(){
git clone https://github.com/xxxx/myRepo.git
cd myRepo
echo "Jpt test1" > jpt1.txt
echo "Jpt test2" > jpt2.txt
echo "Jpt test3" > jpt3.txt
git add jpt1.txt jpt2.txt jpt3.txt
git commit -m "first commit"
git push origin master
######
mkdir system1
cd system1
mkfile 14m outputfile1.out
mkfile 14m outputfile2.out
echo "Jpt test1" > sysjpt1.txt
echo "Jpt test2" > sysjpt2.txt
echo "Jpt test3" > sysjpt3.txt
cd ..
######
mkdir system2
cd system2
mkfile 14m outputfile1.out
mkfile 14m outputfile2.out
cd ..
git add system1 system2
git commit -m "tracking large file"
git push origin master
cd ..
##### Call function BFG which does BFG stuff.
BFG
}
BFG(){
# run bfg and let git clean history
git clone --mirror https://github.com/xxxx/myRepo.git
java -jar bfg-1.13.0.jar --no-blob-protection --delete-folders "{system1, system2}" myRepo.git
cd myRepo.git
git reflog expire --expire=now --all && git gc --prune=now --aggressive
git push
cd ..
mkdir test_new
cd test_new
git clone https://github.com/xxx/myRepo.git
cd myRepo
ls
}
BUILD
当我清洁后克隆并对其进行ls
处理时。我懂了jpt1.txt jpt2.txt jpt3.txt system2
。查看system2文件夹如何仍然存在。
正如您根据上面评论中我的建议进行测试时,问题出在"{system1, system2}"
。处理该表达式时,它会将其扩展为,"system1"
并" system2",
在其前面system2,
没有您想要的空间。
您可以使用两个命令来运行该过程,一次使用system1
一次,一次使用一次,system2,
或者简单地删除空间,一切都会正常进行。
有趣的是,的扩展{a,b}
似乎是由bfg本身完成的,而不是由bash完成的:引号告诉bash从字面上传递该字符串,因此,尽管它看起来像bash语法,但实际上不是bash扩展。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句