Skip to content
Discussion options

You must be logged in to vote

Yep, that’s definitely possible — and it’s actually the easiest way to completely remove the commit history.

You can just delete the old repository from the web (under Settings → Danger Zone → Delete this repository), then create a new one with the same name. Once the old repo is gone, GitHub will let you reuse the name right away.

After that, in your local project folder, just point your code to the new remote and push it up again:

git remote remove origin
git remote add origin https://github.com/yourusername/your-repo-name.git
git branch -M main
git push -u origin main

That’ll give you a completely clean repo — same name, same code, but with all the old commits gone.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@zanilzanzan
Comment options

Comment options

You must be logged in to vote
1 reply
@zanilzanzan
Comment options

Answer selected by joniengr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants