Skip to content

Instantly share code, notes, and snippets.

@szydan
Last active April 3, 2022 01:26
Show Gist options
  • Save szydan/75b8a03b3fb4e099d5c1 to your computer and use it in GitHub Desktop.
Save szydan/75b8a03b3fb4e099d5c1 to your computer and use it in GitHub Desktop.
delete all commits from repo
git checkout --orphan latest_branch && \
git add -A && \
git commit -am "initial commit" && \
git branch -D master && \
git branch -m master && \
git push -f origin master
Taken from
http://stackoverflow.com/questions/13716658/how-to-delete-all-commit-history-in-github
Checkout
git checkout --orphan latest_branch
Add all the files
git add -A
Commit the changes
git commit -am "initial commit"
Delete the branch
git branch -D master
Rename the current branch to master
git branch -m master
Finally, force update your repository
git push -f origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment