How to merge all the content of a branch to another branch?
Solution 1
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:
-
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:
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:
-
You now have to push the changes to BitBucket. Click on the Push button in the toolbar. The following dialog will pop up:
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:
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.
Solution 2
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
- Select A take pull to stay updated.
- Select B select merge, merge from log.
- select A from first column in pop down select latest commit.
- commit merge immediately f no conflicts check box selected, select
Ok
- Resolved xcproject conflicts in editor.
>> <<
You have A changes in B
Steven
Updated on July 08, 2022Comments
-
Steven almost 2 years
I'm new to the world of git, and also to
Atlassian
andSourceTree
, 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 calledrelease
, what I want to do is merge all the content of themaster
branch, to therrelease
branch.What I did so far:
Selected the
master
branch on thebranches
view on the left ofSourceTree
Clicked on the
join
button on the header ofSourceTree
and then onOk
.Clicked on the
Send
button on the header ofSourceTree
.
After the step 3, nothing happen, in my
BitBucket
repository I doesn't see anyRelease
branch, I've actually created this branch onSourceTree
only. Someone could tell me what am I doing wrong?Thanks.
-
Steven about 6 yearsthanks for the very clear explaination :) you're right I pushed the new branch on BitBucket and now working, but I've a question: when I click on the
branches
tab available to the left panel of Bitbucket, the branches window will be opened, I see as Filter "Active" and "Merged". I can see therelease
branch only when I click onMerged
, what does meanActive
? And why therelease
branch is only available onMerged
and not onActive
? Thanks again. -
Mika Sundland about 6 years@johnn You will see the release branch in the Active filter when it's "ahead" of the master branch. In my second picture, you can see that the release branch one commit ahead of the master branch. When it's not ahead anymore you can find with the Merged filter. If you see it under Merged then you might have merged the release branch into the master branch, instead of the other way. For example like this. After doing the merge in the picture the release branch was moved to the Merged filter.
-
Steven about 6 yearsOk I need to do some practice with these things, where did you learn this? Did you use the source tree documentation or is there a guide for basic users? thank you.
-
Mika Sundland about 6 years@johnn I use Git and SourceTree both for work and for hobby projects. SourceTree is just a GUI for Git, so following any Git tutorial should work. Instead of typing out the commands you push buttons instead. The principle is the same. In the beginning, one only needs to be able to commit, push, pull and branch. Anything else can easily be googled when that time comes.