Steven
Steven

Reputation: 183

How to merge all the content of a branch to another branch?

I'm new to the world of git, and also to Atlassian and SourceTree, so I've very basic about this. What I want achieve is that:

Suppose that I've a branch called master, which I develop my application with all new features and bugfix, and another branch called release, what I want to do is merge all the content of the master branch, to ther release branch.

What I did so far:

  1. Selected the master branch on the branches view on the left of SourceTree

  2. Clicked on the join button on the header of SourceTree and then on Ok.

  3. Clicked on the Send button on the header of SourceTree.

After the step 3, nothing happen, in my BitBucket repository I doesn't see any Release branch, I've actually created this branch on SourceTree only. Someone could tell me what am I doing wrong?

Thanks.

Upvotes: 6

Views: 15498

Answers (2)

Abhijeet Ravi
Abhijeet Ravi

Reputation: 295

Follow this step-by-step process:

MERGE ONE BRANCH INTO ANOTHER

Branch B is new branch and we want want branch A code in B
  1. Select A take pull to stay updated.
  2. Select B select merge, merge from log.
  3. select A from first column in pop down select latest commit.
  4. commit merge immediately f no conflicts check box selected, select Ok
  5. Resolved xcproject conflicts in editor. >> <<

You have A changes in B

Upvotes: 1

Mika Sundland
Mika Sundland

Reputation: 18939

To me, it sounds like you're not pushing the correct (or all) branches to BitBucket. Here is a complete example of how it's done:

  1. Let's assume you have a repository with two branches: master and release. You do development on the master branch and only do releases on the release branch. It will then look something like this:

    SourceTree - merge branches

    When you want to merge the master branch into the release branch you checkout the release branch (right click on it and choose Checkout release...). Then right-click on the branch you want to merge into the release branch (master) and choose Merge master into current branch. The result is this:

    SourceTree - master branch merged into release branch

  2. You now have to push the changes to BitBucket. Click on the Push button in the toolbar. The following dialog will pop up:

    SourceTree - pushing changes dialog

    You now have to choose the branches you want to push. If you don't push a branch it will not end up on BitBucket. In this case, I want both my branches to be there so I'll tick both the Push? checkboxes. On BitBucket it will now look like this on the Branches page:

    BitBucket - Branches page

    You will also see the remote branches in SourceTree under the remotes dropdown.

What you're most likely doing wrong is that you're not pushing the release branch to BitBucket.

Upvotes: 14

Related Questions