git reset --soft HEAD^
git add -A .
git commit -m "rewriting history"
git push --force origin master
-
Delete the .git directory locally.
-
Recreate the git repostory:
$ cd (project-directory)
$ git init
$ git commit --allow-empty -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
git checkout --orphan reset
git commit --allow-empty -m "reset"
git branch -D master
git branch -m master
git push -f origin master