GIT , Remove all old changes and make Current as initial

Submitted by editor on Sun, 09/18/2016 - 11:10
Question

How to remove all git repository history and set the current state as initial commit ?

This is the brute-force method. It also removes the configuration of the repository.

Step 1: remove all history
rm -rf .git

Step 2: reconstruct the Git repository with current content
git init
git add .
git commit -m "Initial Commit"

Step 3: push to Git.
git remote add origin <git-uri>
git push -u --force origin master

Tags

Add new comment

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.