NotesUESTC/代码同步协作/Git麻烦问题解决.md

12 lines
480 B
Markdown
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

1、Git 某次Commit 有大文件导致Github无法提交上去
解决方案是把这个大文件从历史的所有提交剔除,如下面的命令所示:
```shell
# 使用双引号将文件路径括起来
# 当你的路径存在空格的时候容易导致命令行识别错,可以把你要删除的路径的文件加上""
git filter-branch --force --index-filter 'git rm --cached -r --ignore-unmatch "your path"' --prune-empty --tag-name-filter cat -- --all
```