How To Clear All GitHub Commit Records?

solution

  1. New orphan branch
git checkout --orphan latest_branch
  1. Add the required files to the staging area
git add -A
  1. Commit
git commit -m "..."
  1. Delete the main branch
git branch -D main
  1. Rename the current latest_branch branch to main branch
git branch -m main
  1. Finally, push to the remote repository
git push -f origin main

Comments