1. I committed a .log file (about 140M) in the project before, and when I pushed it to git.oschina, I was prompted that the file was too large and could not be pushed. Then I used the 'delete' key on the computer keyboard to delete it. file, commit here and then push, still the same error is reported
为情所困2017-05-02 09:31:14
Simply adding a new onecommit
或者commit --amend
only deletes this file from the current version. The entire process of adding this file and deleting this file is still recorded in the historical submission.
If you want to completely remove this file from the repository, you must rewrite all commits in the history where this file exists.
To rewrite history, you can use git filter-branch
. For details, see the tutorial on Github. git filter-branch
,具体可以看Github上的教程。
当然对于简单的情况,你也可以选择git reset
加git rebase
Of course, for simple situations, you can also choose git reset
plus git rebase
.
Supplement:git rm file.log
相当于rm file.log && git add file.log
, the questioner has deleted the file and submitted it. If you don’t understand, please don’t answer randomly, okay...
怪我咯2017-05-02 09:31:14
git rm --cached <filename>
Then perform add commit and other operations again
You can ignore the .log file in the .gitignore file
Otherwise it would be too troublesome to delete it every time it is generated