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
1.4m articles
1.4m replys
5 comments
57.0k users