As mentioned, I haven’t pushed to github for half a year. Since there are several jars in it that have not been ignored, there are more and more. After pushing, it will report:
Counting objects: 4779, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3903/3903), done.
error: RPC failed; result=56, HTTP code = 200 | 14.92 MiB/s
fatal: The remote end hung up unexpectedlyMiB | 158.00 KiB/s
Writing objects: 100% (4779/4779), 628.84 MiB | 152.00 KiB/s, done.
Total 4779 (delta 2353), reused 3 (delta 0)
fatal: The remote end hung up unexpectedly
Everything up-to-date
I searched for some methods, such as changing to ssh, etc., but none of them worked. Is there any simple way to discard the history and only push the current version?
There is really no choice but to clone and overwrite again, but there are hundreds of megabytes online, so it would be best if there are any command parameters that can be simply discarded.
Find a way https://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html to clear the history. I am currently trying it. I will continue writing when it is OK.
I finally found a simple way. Using the filter-branch command that comes with git can filter and delete, but it is too slow. I ran it all night and it didn't end, stuck at 98% progress. Later, I found the BFG Repo-Cleaner tool and deleted it within a few minutes. The size of the .git directory was reduced from about 2.9G to 70M. I deleted all tar.gz, zip, jar, war, etc. submitted in the past. Leave the source code behind and finally push it to github.
The specific execution process is:
Rebase, -f when pushing