Delete commits history with git commands
- Check out to a temporary branch:
- Add all the files:
- Commit the changes:
- Delete the old branch:
- Rename the temporary branch to master:
- Force update to repository:
Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH
Add all the files:
git add -A
Commit the changes:
git commit -am "Initial commit"
Delete the old branch:
git branch -D master
Rename the temporary branch to master:
git branch -m master
Force update to repository:
git push -f origin master