Skip to content

Instantly share code, notes, and snippets.

@mscribellito
Last active December 3, 2021 19:56
Show Gist options
  • Save mscribellito/470f67e0788cee8e7eed42d1864dbf59 to your computer and use it in GitHub Desktop.
Save mscribellito/470f67e0788cee8e7eed42d1864dbf59 to your computer and use it in GitHub Desktop.
Delete Git commit history
# Create orphan branch
git checkout --orphan temp_branch
# Add files to branch
git add -A
git commit -am "First commit"
# Delete main branch
git branch -D main
# Rename current branch
git branch -m main
# Push changes
git push -f origin main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment