Delete all git commit

Written on 15 May 2016

Delete all git commit message will make the current commit become (initial) commit in a Git repository

Step 0: copy .git/config

cp .git/config .  

Step 1:Delete git commit

rm -rf .git  

Step 2: reconstruct the Git repo with only the current content

git init  
cp config .git/config  
git add .  
git commit -m "Initial commit"  

Step 3: push to GitHub.

git push -u --force origin master  
Read more on git clear