lo *_*cre 4 git github unstage
我F试图推送一个超过 100 MB 限制的文件。所以推送失败了。然后我删除了文件,因为它不能被推动,假设我需要做的add . ; commit和push试。在自动生成的提交中,它说deleted file F。当push它仍试图上传该文件。好吧,所以我想我需要 unstage F。所以我做到了reset F。我收到消息fatal: ambiguous argument 'out': unknown revision or path not in the working tree.不知道那是什么意思,所以我尝试让 git 向我显示暂存文件diff --cached,但输出为空。我对这种情况以及如何解开它感到困惑。
回顾一下链条:
$> git add. ; git commit
$> git push
$> remote: error: File F is 143.41 MB; this exceeds GitHub's file size limit of 100.00 MB
$> rm F
$> git add. ; git commit
$> git push
$> remote: error: File F is 143.41 MB; this exceeds GitHub's file size limit of 100.00 MB
$> git diff --cached
$>
问题是该文件已经是历史提交的一部分。
您需要返回提交并修改它:
# reset to previous commit but keeping content:
git reset --soft "HEAD^"
# potentially modify the tree content
# amend the old commit with the file removed:
git commit --amend
# push:
git push
Run Code Online (Sandbox Code Playgroud)