TBJ TBJ - 1 year ago 90
Git Question

How to switch to master, when there is no master

I have built a website with git and from the beginning I have done no work in the master branch, which is now empty. I started out with:

$ git checkout -b dev_project

and have done all my development in that branch. I thought it would be good to use the master branch as a release branch, but I can see that locally I don't have that branch.

c:/wamp/www>git branch
8.0.x. (my drupal branch)
dev_project (my project branch)

So how can I merge dev_project HEAD into master?

Answer Source

Create the branch master:

git branch master dev_project

You don't have anything to merge. Master will actually diverge from dev_project. That seems weird but it's actually what you want to do.

Continue working on dev_project, and when you want to release merge it into master, issuing:

git checkout master
git merge dev_project
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download