Sometimes we might have a lot of commits in a particular GitHub repository and it looks kinda annnoying. In this case we might look to delete all the commits and start fresh with 0 commits. Here are the commands to do so and you can use the command prompt or VSCode or any other IDE's terminal for the same.
Navigating to the current working directory of the project
cd "directory-path"
Creating a new branch
git checkout --orphan new_branch
Adding files into the repository
git add .
Commit message
git commit -m "first commit"
Deleting the main branch
git branch -D main
Renaming the new branch as the original branch
git branch -m main
Pushing the changes
git push -f origin main
Refresh the repository page and there you go. Now you have only 1 commit. Whenever you wish to delete commits further, you can follow same steps as above for all repositories. Remember, it only deletes the commits of a particular repository but while going through GitHub commit stats, no changes will be reflected.
I also created a blog on how to link your project file to a GitHub repository. Navigate to the "Pushing the code to GitHub" section of the below link to check the required commands.
ReactJS: Complete Guide