Skip to content

Instantly share code, notes, and snippets.

@sandipchitale
Last active October 1, 2023 22:25
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sandipchitale/b423099eccfdaba5037cefcb4de5d57f to your computer and use it in GitHub Desktop.
Save sandipchitale/b423099eccfdaba5037cefcb4de5d57f to your computer and use it in GitHub Desktop.
Collapse all history of git repo. #git
git checkout --orphan onetime
git add -A
git commit -m "Initial commit"
git branch -D main
git branch -m main
git gc --aggressive --prune=all
git push -f origin main
git checkout --orphan onetime
git add -A
git commit -m "Initial commit"
git branch -D master
git branch -m master
git gc --aggressive --prune=all
git push -f origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment