Skip to content

Instantly share code, notes, and snippets.

@dantullis
Last active February 23, 2022 04:14
Show Gist options
  • Select an option

  • Save dantullis/e342147c8a091815968ef387e031cafc to your computer and use it in GitHub Desktop.

Select an option

Save dantullis/e342147c8a091815968ef387e031cafc to your computer and use it in GitHub Desktop.
Remove Git commit history on remote repo

Steps to remove Git commit history on remote repo

Remove the history from local repo

rm -rf .git

Recreate the repo from the current content only

git init
git add .
git commit -m "Initial commit"
git branch -M main

Push to the remote GitHub repo ensuring you overwrite history

git remote add origin git@github.com:<user>/<repo>.git
git push -u --force origin main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment