Skip to content

Instantly share code, notes, and snippets.

@dstollie
Last active December 9, 2015 21:10
Show Gist options
  • Save dstollie/0c108159b0760aac1462 to your computer and use it in GitHub Desktop.
Save dstollie/0c108159b0760aac1462 to your computer and use it in GitHub Desktop.
Remove all commits to reset a remote GIT repository
#!/bin/sh
#
# 1. Delete the .git directory locally.
# 2. Recreate the git repostory:
$ cd (project-directory)
$ git init
$ (add some files)
$ git add .
$ git commit -m 'Initial commit'
# 3. 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment