If you want to delete all of our commits history, but keep the code in its current state, try this
- Check out to temp branch:
git checkout --orphan temp_branch
--orphan
: Create a new orphan branch. The first commit made on this new branch will have no parents and it will be the root of a new history totally disconnected from all the other branches and commits.
- Add all the files:
- Commit the changes:
git commit -am "Initial commit"
- Delete the old branch:
- Rename the temp branch to master:
- Finally, force update to our repository:
git push -f origin master