react-native : can't push to git because of hprof file

耗尽温柔 提交于 2020-05-27 05:11:53

问题


I would like to push my project into the github, however i just notice there is a file called java_pid14920.hprof inside the android folder and cause around 300MB

remote: error: File android/java_pid14920.hprof is 301.75 MB; this exceeds GitHub's file size limit of 100.00 MB

I wonder it is safe to delete this file ?


回答1:


This sounds like a heap profiling output file, which you probably don't want in your repository at all. You'll want to delete it from the entire history and probably add an entry to .gitignore to ignore *.hprof. If the file is not in the latest commit, simply deleting it there won't make your repository pushable to GitHub; you'll have to remove the object from the entire history.

If you can easily find the commit which introduced it (try git log -- android/java_pid14920.hprof), you can do a git rm android/java_pid14920.hprof and then do git commit --fixup HASH-OF-COMMIT && GIT_SEQUENCE_EDITOR=true git rebase -ir --autosquash HASH-OF-COMMIT^ (note the caret) to rebase out the file.

You can also use a tool like git filter-branch or bfg to filter out large objects that you don't want.

Note that doing this will rewrite the history of any intervening commits, changing their object IDs.



来源:https://stackoverflow.com/questions/58646396/react-native-cant-push-to-git-because-of-hprof-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!