If we want to delete all of our commits history, but keep the code in its current state, try this:
# Check out to a temporary branch:
git checkout --orphan TEMP
# Commit the files:
git commit -m "Initial commit"
# Delete the main branch:
git branch -D main
# Rename the current temporary branch to main:
git branch -m main
# Force push to our repository:
git push -f origin main
# Remove the old files
git gc --aggressive --prune=all
This will not keep our old commits history around.
Note: Git will continue to store history for any commits that are referenced with branches or tags. To check, run git tag -l and git branch -v, then delete any you find. Also double check your remote with git ls-remote, you may need to delete remote tags/branches as well or when you fetch you will get all the linked files again.