Completely reset GIT repository | Drupal 8

Completely reset GIT repository

Submitted by editor on Wed, 03/21/2018 - 19:29

How to reset a remote GIT repository to remove all commits ?

Completely reset

Delete the .git directory locally.

Recreate the git repository:

$ cd (project-directory)
$ git init
$ (add some files)
$ git add .
$ git commit -m 'Initial commit'

Push to remote server, overwriting. Remember you're going to mess everyone else up doing this … you better be the only client.

$ git remote add origin <url>
$ git push --force --set-upstream origin master


Add new comment

Plain text

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