Clear out the history of a git repository

Git

Steps to clean out the commits history of a git repository

sh

# 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 git@github.com:<YOUR_ACCOUNT>/<YOUR_REPO>.git git push -u --force origin master

to pull from an already cloned repo:

sh

git pull origin master --allow-unrelated-histories