Create an empty git branch

It’s really easy to create a new empty git branch with no parents (AKA orphan branches). First create an orphan branch with git checkout --orphan newbranch. Now you can remove any files in the directory with git rm -rf * and finally push it to a github repository with git push origin newbranch.

If you create branch in Github it’ll create the branch from master (which is what you’re going to do most of the time). Sometimes it makes more sense to create new branches. Example:

I learned this a while ago from a Github Post.

 
0
Kudos
 
0
Kudos

Now read this

When not to “Fork” on Github

TL;DR: Fork in Github is not as same as Like in Facebook. Github has Star for that. Fork only when it makes sense or you’ll end up with a few old repos. Forking can be really useful if you want to submit a patch to the parent repo. When... Continue →