把某个文件的记录从git中删除
使用命令:(
git filter-branch
git filter-branch --index-filter <span style="color:#abe338">'git rm --cached --ignore-unmatch <file_path>'</span> -- --all然后使用:(
git push --force
git push --force origin
注意:
如果运行的时候不是在根目录或者文件的路径写的不对,提示了‘cannot create a new bachup’就使用:
rm -r .git/refs/original/如果是windows,使用:
rmdir /s .git\refs\original删除后,继续使用:
git filter-branch --index-filter <span style="color:#abe338">'git rm --cached --ignore-unmatch <file_path>'</span> -- --all
然后继续操作。即可。