Thrillofit86
Thrillofit86

Reputation: 629

How to create new empty branch through GitHub.com?

So I have been trying for quite while asking people on programming help through discord, searching on Google etc etc and nothing was found.

What I am trying to do is to create new branch without having any files from 'master' meaning basically an empty branch and I am stuck not knowing what to do from here and I haven't found a solution through that to do directly on github.com

Branch master

Upvotes: 1

Views: 2655

Answers (2)

Philippe
Philippe

Reputation: 31237

GitHub don't allow this because that's not a standard need.

But you could do:

git checkout --orphan my-new-branch

that create a branch not link to any commit. And then commit.

You will have a new commit history/tree root (depending on the file you put into it, probably not mergeable with any branch belonging to the other graph without conflicts).

Upvotes: 4

Antoine
Antoine

Reputation: 3

A branch is always a copy from some other but for the initial branch (master).

What you can do is create a branch, then remove all, then commit. However, do not merge the branch on the master or you will loose everything (from that version).

Upvotes: 0

Related Questions