Skip to content

Instantly share code, notes, and snippets.

@youngshook
Last active January 1, 2016 07:49
Show Gist options
  • Save youngshook/8114222 to your computer and use it in GitHub Desktop.
Save youngshook/8114222 to your computer and use it in GitHub Desktop.
Create a new orphan branch, use three ways. A orphan branch like Github Pages(create a gh-pages branch).
#1. Hack ./git/HEAD file
echo ref: refs/heads/orphan_branch_name
git rm -rf .
# .............. # add file ... commit file ...
#2.Use --orphan parameter
git checkout --orphan orphan_branch_name
git rm -rf .
# .............. # add file ... commit file ...
#3.Use git symbolic-ref command
git symbolic-ref HEAD refs/heads/orphan_branch_name
rm .git/index
# .............. # add file ... commit file ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment