Skip to content

Instantly share code, notes, and snippets.

@eromatiya
Created May 11, 2020 11:50
Show Gist options
  • Save eromatiya/778e9c7504375306785f115aa434f39d to your computer and use it in GitHub Desktop.
Save eromatiya/778e9c7504375306785f115aa434f39d to your computer and use it in GitHub Desktop.
Reset github repo history

My dotfiles became so big that cloning it even using depth 1 is a pain in the ass. Yeah, I have a very slow internet connection. That's why I need to reset the history.

$ # Reset history
$ rm -rf .git

$ # Re-initialize
$ git init
$ # Add file contents to index
$ git add .
$ # Commit the files in your repo
$ git commit -m "nuked history"

$ # Add remote origin
$ git remote add origin git@github.com:/.git
$ # Push to the github remote repo, will overwrite history
$ git push -u --force origin master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment