0

TL;DR -- I do this http://nvie.com/posts/a-successful-git-branching-model/ but never use master. Now what?

I started several projects using the git-flow model, where master is the "current release" branch. However, none of these projects were web projects, and there was never such thing as a "current release", as multiple release versions have always been supported.

So now I've got a develop branch, and several feature and release branches that are intertwined via develop as per git-flow's template, but the merge to master has been rare, somewhat random, and generally useless.

What I'd like to do is just replace master with develop, and pretend that the old master never existed.

Can I just merge the two (master is 0 ahead of develop), kill develop, and be done? Will that kill off my feature and release branches since they're branched off develop, or have any other adverse effect on them? Or will it keep everything around and make it look like develop was the real master all along?

lobsterism
  • 3,469
  • 2
  • 22
  • 36

1 Answers1

0

Branches are like pointers. You can have any number of pointers to the same commit, and moving or deleting one pointer has no affect on the others that point to the same commit, or to any other commit.

So yes, you can do as you describe (delete master, rename develop to master) and be done.

For maximum fun, do a fresh clone and experiment until you get it looking like you want.

EDIT: If others are using your repo, you may want to be a bit more careful to not rewrite history. See Make the current git branch a master branch

Community
  • 1
  • 1
engineerC
  • 2,808
  • 17
  • 31
  • My description was actually reverse order: merge develop to master, then delete develop. Does it make a difference? – lobsterism Dec 04 '14 at 05:39
  • If it's a fast-forward merge from develop to master, then the end result is the same as if you delete and swap (one pointer called master at the existing commit). If it's not, then there will be a new commit. However, any currently unmerged feature branches from what used to be develop should merge normally into the branch now called master. – engineerC Dec 04 '14 at 17:11