Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

#Name: How to create an empty stand-alone branch in Git
#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