Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to merge develop branch to master branch within SourceTree?

I have created a local git repository in C:\temp\ConsoleApplication1. Then I click the Git Flow button and follow by OK to accept all default settings. Now under the branches, I can see develop and master.

Next I click Git Flow again to start a new feature, then make some changes and finally finish the feature.

Now my branch looks as follows:

[develop] add line 1 [master] initial commit 

Question: I would like to merge the develop into the master branch. What is the right method to achieve that?

http://i64.tinypic.com/259ye6b.png

I have tried to select develop branch, then click Merge button. No matter which commit I choose, there is nothing happens. I also tried to select master and see no difference.

like image 990
q0987 Avatar asked Jan 08 '16 22:01

q0987


People also ask

Can you merge a branch of a branch to master?

Once the feature is complete, the branch can be merged back into the main code branch. First we run git checkout master to change the active branch back to the master branch. Then we run the command git merge new-branch to merge the new feature into the master branch.

Can you merge main branch with development branch?

Basic main/master branch development logic is: You work only on another branches, so you use main/master branch only to merge with another branch which is ready for merging.


2 Answers

  1. Checkout master
  2. Click Merge button and Merge dialog opens
  3. Select commit with message "add line 1" and click OK

Not entirely clear in the question, but did you try this already? The key step is making sure you currently have master checked out.

like image 146
dtmland Avatar answered Oct 04 '22 15:10

dtmland


Sourcetree has changed a fair bit since this question was asked, but just in case others arrive here and don't quite understand the new "Merge" button, all you need to do is checkout the branch you want to merge your changes into, e.g. "master" (double click on the branch on the left in Sourcetree under "Branches).

Next, just right-click on the branch you want to merge into your current branch (e.g. "my-new-branch") and from the right-click menu, select "Merge my-new-branch into master". This helped me coming to Sourcetree as a GitKraken user.

enter image description here

like image 24
wickywills Avatar answered Oct 04 '22 15:10

wickywills