git一不小心上傳了大文件,怎么破?

1、重寫commit,刪除大文件**

git filter-branch --force --index-filter "git rm -rf --cached --ignore-unmatch dns.zip" --prune-empty --tag-name-filter cat -- --all

dns.zip:文件名

2、如果報(bào)錯(cuò)了咋辦?**

報(bào)錯(cuò):Cannot rewrite branches: Your index contains uncommitted changes.

解決:git stash

3、如果沒有報(bào)錯(cuò),就一直等待清理完成,推送即可:**

git push origin master --force

如果報(bào)了第2步的錯(cuò),就需要解決后重新執(zhí)行:git filter-branch --force --index-filter "git rm -rf --cached --ignore-unmatch CPT_0707_ao/temp_past/temp2/deltap.csv" --prune-empty --tag-name-filter cat -- --all,等待修復(fù)完成后git push

4、清理和回收空間**

rm -rf .git/refs/original/

git reflog expire --expire=now --all

git gc --prune=now

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容