2

I am very new to git.

Not so long ago I learnt about GitFlow, and I'd like to utilize it, however I have already got a long commit history in my master branch.

Can I move everything over to develop, so I'll get the whole history, and commiting only my latest release to master?

I am using Tower on my mac, but I am happy to use command line as well.

Ben S
  • 558
  • 3
  • 18

1 Answers1

2

If you don't have a develop branch yet, you can simply create one at the right point of master:

git checkout -b develop master~1

That way, the last commit of master is in master only, all the other commits are part of the new develop branch.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for the quick answer. I have a develop branch already. Would this work either way, if I leave out the `-b` flag? I would like to learn the meaning of this `master~1`. – Ben S Sep 11 '16 at 14:51
  • 1
    @BenS In that case, it is best to merge `master` to `develop` (or `master~n` to `develop`, if you don't want to integrate the last n commits of `master`) – VonC Sep 11 '16 at 14:59