2

I often want to make the current branch the master branch, like described in this question. I use the approach that Jefromi answered.

I wonder how I can do exactly this with source tree?

Community
  • 1
  • 1
brainray
  • 12,512
  • 11
  • 67
  • 116
  • Is there a reason not to do it using the git command directly like in [the answer to the linked question](http://stackoverflow.com/a/2763118)? – Hasturkun Jun 30 '15 at 07:32
  • 1
    @Hasturkun: convenience. I can't keep the commands in my head. – brainray Jun 30 '15 at 07:39

2 Answers2

-1

When your in the branch you want to copy the master branch to, run this command:

git merge master

you can read about what it does here

Aryeh Armon
  • 2,137
  • 2
  • 22
  • 37
  • 2
    I don't think that's what the question is. Asker isn't asking how to copy/merge the master branch to another, but rather how to replace the master branch using another. – Hasturkun Jun 30 '15 at 07:34
  • @Hasturkun: Yes, you are right. I edited the subject so that it's clearer – brainray Jun 30 '15 at 07:41
  • How about deleting the brach and then create a new one and checkout from the master branch. Is there any reason you would want to keep the commits of the branch? – Aryeh Armon Jun 30 '15 at 13:07
-1

Well Jefromi's answer is perfect to keep the content in branch . But, I wonder why we try to make our current branch as master branch at any stage. Best practice says, Well plan your project and never make direct changes in master. Always, Master changes are merged into the branch and then branch is pushed to master.

Community
  • 1
  • 1
Jyoti Prakash
  • 3,921
  • 3
  • 21
  • 24