Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KlausEverWalkingDev/1ec5f4667734ed74f7008a8d49ee8239 to your computer and use it in GitHub Desktop.
Save KlausEverWalkingDev/1ec5f4667734ed74f7008a8d49ee8239 to your computer and use it in GitHub Desktop.

#Name: How to create an empty stand-alone branch in Git
#By http://web.archive.org/web/20131201004723/http://sidja.in/post/62663941071
#Version: N/D
#Release Date: September 5th, 2019

#Change to your project folder
$ cd my-project-folder

$Create orphan branch
$ git checkout --orphan my-branch

#Delete everything's left in the orphan branch
$ git rm -rf .

#Make some changes
$ touch dummy-file && echo "dummy-text" > dummy-file

#Add and commit the changes
$ git add dummy-file $ git commit -m "Adding dummy-file"

#Check commits' history
$ git log

#Come to and from a branch to test them
$ git checkout master $ git checkout my-branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment