Skip to content

Instantly share code, notes, and snippets.

@mckaygerhard
Forked from seanbuscay/git_create_orphan.sh
Last active May 3, 2023 14:00
Show Gist options
  • Save mckaygerhard/d98568bba4a6320668b26eeb10244c67 to your computer and use it in GitHub Desktop.
Save mckaygerhard/d98568bba4a6320668b26eeb10244c67 to your computer and use it in GitHub Desktop.
Create an orphan branch in a repo, new branch with empty history
cd repository
git checkout --orphan orphan_name
git rm -rf .
rm '.gitignore'
echo "#Title of Readme" > README.md
git add README.md
git commit -a -m "Initial Commit"
git push origin orphan_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment