How can I reset a remote and local Git repository to remove all commits?
I would like to start fresh with the current Head as the initial commit.
Completely reset?
Delete the .git directory locally.
.git
Recreate the git repostory:
$ 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
2.1m questions
2.1m answers
60 comments
57.0k users