1

I have created a repository for my project, and there has been only a "develop" branch. I just forget to create a "master" branch at the beginning. Now, All my work is on the "develop" branch.

Now, I would like to create a "master" branch, but I don't want this "master" branch to be created from "develop", instead, I'd like to have it as an independent branch that doesn't contain my work at all. How to create this "master" branch?

Leem
  • 17,220
  • 36
  • 109
  • 159
  • 1
    Does this answer your question? [How to create a new empty branch for a new project](https://stackoverflow.com/questions/13969050/how-to-create-a-new-empty-branch-for-a-new-project) – jonrsharpe Mar 27 '20 at 08:24

1 Answers1

1

To create a new master branch pointing at your repo's initial commit :

git branch master $(git rev-list --max-parents=0 @)
Romain Valeri
  • 19,645
  • 3
  • 36
  • 61