Check git repo size : git count-objects -v
First checkout to the commit, which you want to make as the initial commit. Then run the following commands :
git checkout --orphan temp_branch
git add -A
git commit -am "Initial commit message"
git branch -D main
git branch -m main
git push -f origin main
git gc — aggressive — prune=all # remove the old files
The above commands will force fully push the current source code to main
branch as the first command.
Note : You should delete all other branches and tags, because it may still contain the old history.