Skip to content

Instantly share code, notes, and snippets.

@kristofk
Forked from seanbuscay/git_create_orphan.sh
Last active April 22, 2018 12:07
Show Gist options
  • Select an option

  • Save kristofk/d25ae85d5f021fae2c4e6685101417b2 to your computer and use it in GitHub Desktop.

Select an option

Save kristofk/d25ae85d5f021fae2c4e6685101417b2 to your computer and use it in GitHub Desktop.
Create an orphan branch in a repo
# Prepare branch
cd repository
git checkout --orphan <orphan-name>
git rm -rf .
rm '.gitignore'
# Create a commit (this can be empty) and push
git commit --allow-empty -m “root commit”
git push origin orphan_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment