36

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.

Melebius
  • 6,183
  • 4
  • 39
  • 52
q0987
  • 34,938
  • 69
  • 242
  • 387
  • 1
    I have found out the issue I had. The correct way is to 1> checkout master 2> click merge 3> select all branches in the drop-down menu. The step 3 is important otherwise. 4> select the develop branch then click OK. You can also do the same thing in the reverse order. 1> checkout develop 2> click merge 3> select all branches 4> click master 5> click ok. – q0987 Jan 08 '16 at 22:44
  • Did the solution below work for you? If so can you mark it as solved? – dtmland Apr 21 '17 at 15:31
  • Everyone can see the timestamp of my answer below and the timestamp of your comment above. Can you please mark the answer as correct? – dtmland Jun 07 '18 at 15:08

5 Answers5

31
  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.

dtmland
  • 2,136
  • 4
  • 22
  • 45
28

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

wickywills
  • 4,024
  • 2
  • 38
  • 54
0

As you said you are using git flow, the right way to merge develop into master is to start a new release branch.

After you have run tests on the release branch by finishing release it would merge on both develop and master to bring all the latest changes to the branches. Also they have a guide smarter branching with sourcetree on their blog.

David Buck
  • 3,752
  • 35
  • 31
  • 35
-1
  1. Within SourceTree, switch your working copy to the local/branch
  2. Merge the changes from the remote/master using SourceTree or git command prompt
  3. Resolve conflicts using Sourcetree or external text editor.(save changes to yours that you want to keep, discard remote conflict)
  4. Commit and push the changes to remote/branch
  5. On the GitHub web UI, switch to the relevant branch, then create a new pull request(If all conflicts are not resolved you will not be able to create a pull request)
  6. Admins will be notified of pull request and changes will be accepted or changes will be requested. If there are no admins setup, the pull request will automatically get merged.
OneXer
  • 303
  • 9
  • 20
  • 2
    The question was only for 2) with Sourcetree only, but this answer doesn't provide details on how to do that. – aled Sep 11 '18 at 12:46
-1

I think you need to create a local "master" branch tracking your remote origin/master.

In Git command line:

 git push -u origin master
  1. You must firstly commit and push you changes in local development in origin/development.

  2. You merge your changes from local development into local master (create above)

  3. From there commit and push into you remote master branch

johnashu
  • 2,167
  • 4
  • 19
  • 44