Remove a git repo's history

git checkout --orphan tmp-main # create a temporary branch
git add -A  # Add all files and commit them
git commit -m 'Add files'
git branch -D main # Deletes the master branch
git branch -m main # Rename the current branch to master
git push -f origin main # Force push master branch to Git server
git branch --set-upstream-to=origin/main main # Local master tracks origin/master
git gc --aggressive --prune=all # remove the old files

# Reset cloned repos
git fetch --all
git reset --hard origin/main