Delete all commit history in GitHub
Posted by Bipul Raman on April 26, 2019.Problem Scenario: You want to delete all commit history but keep the code in its current state.
Solution: To achieve this, follow below steps through command line.
Step 1: Checkout to some new branch
git checkout --orphan new_branch
Step 2: Add all the files
git add -A
Step 3: Commit the changes
git commit -am "commit message"
Step 4: Delete the master branch
git branch -D master
Step 5: Rename the current branch to master
git branch -m master
Step 6: Force update your repository
git push -f origin master