Skip to content

Instantly share code, notes, and snippets.

@bastami82
Created October 18, 2024 10:54
Show Gist options
  • Save bastami82/5cbdee409c0b58fc577bc021e06b1c86 to your computer and use it in GitHub Desktop.
Save bastami82/5cbdee409c0b58fc577bc021e06b1c86 to your computer and use it in GitHub Desktop.
How to create a new orphan branch from existing repository (where new branch does not have former git commits history)
git checkout --orphan <new-local-branch-name>
git add .
it commit -m "init commit - with no git history"
optional push to `origin` :
git push -u origin main // this will track new-local-branch-name with origin/main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment