Skip to content

Instantly share code, notes, and snippets.

@paulobunga
Last active April 25, 2021 11:59
Show Gist options
  • Save paulobunga/35acbc2d4d14f22edb07e3993de14665 to your computer and use it in GitHub Desktop.
Save paulobunga/35acbc2d4d14f22edb07e3993de14665 to your computer and use it in GitHub Desktop.
How to clean all commits from remote github repository

Checkout

git checkout --orphan latest_branch

Add all the files

git add -A

Commit the changes

git commit -am "commit message"

Delete the branch

git branch -D main

Rename the current branch to main

git branch -m main

Finally, force update your repository

git push -f origin main

@paulobunga
Copy link
Author

How to clean all commits from remote git repository

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