It’s really easy to create a new empty git branch with no parents (AKA orphan branches). First create an orphan branch with this command.
git checkout --orphan newbranch
Now you can remove any files in the directory and finally push it to a Github repository.
git rm -rf * 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:
- Code Rewrites
- Github Pages
I learned this a while ago from a Github Post.
Original Post: https://mnmtanish.svbtle.com/create-an-empty-git-branch