GIT , Remove all old changes and make Current as initial | Drupal 8

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

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.