gpt4 book ai didi

git - 我的 git push 卡在了一个大文件上。该怎么办?

转载 作者:太空狗 更新时间:2023-10-29 12:52:38 25 4
gpt4 key购买 nike

我收到一个致命的 sha1 错误。我相信它在尝试写入大文件时遇到了困难。我的状态显示我提前 8 次提交。我试图将文件扩展名添加到排除文件夹中的忽略列表,但它仍然卡住了。如何在不丢失本地更改(大文件除外)的情况下继续操作?

我试过了 Predict how much data will be pushed in a git push bundle 很大~650MB。

我不知道如何忽略以前未推送的提交中的文件。我可以在不丢失本地文件的情况下清除旧提交吗?然后删除大文件然后再次提交?

最佳答案

来自 http://git-scm.com/book/en/Git-Tools-Rewriting-History :

Removing a File from Every Commit

This occurs fairly commonly. Someone accidentally commits a huge binary file with a thoughtless git add ., and you want to remove it everywhere. Perhaps you accidentally committed a file that contained a password, and you want to make your project open source. filter-branch is the tool you probably want to use to scrub your entire history. To remove a file named passwords.txt from your entire history, you can use the --tree-filter option to filter-branch:

$ git filter-branch --tree-filter 'rm -f passwords.txt' HEAD

但是如果它只是最后一次提交你搞砸了你可以用 git rm large_filegit commit --amend 解决它

关于git - 我的 git push 卡在了一个大文件上。该怎么办?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23589167/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com