Clear out the history of a git repository


Steps to clean out the commits history of a git repository


# Remove the .git directory rm -rf .git # Recreate a new repo with the current content git init git add . git commit -m "Initial commit message" # Push to remote git remote add origin<YOUR_ACCOUNT>/<YOUR_REPO>.git git push -u --force origin master

to pull from an already cloned repo:


git pull origin master --allow-unrelated-histories