2 min episode 12 of 24
In our last video, we had created a new branch and committed some work there. In this video, we’ll integrate this work back into our "master" branch.
Let’s look at this in slow motion.
We’ll take this as our starting situation: We’ve worked hard and made a couple of commits on our signup feature branch. In the meantime, the main project has moved on with other changes.
We now want to integrate our changes from the signup branch back into the "master" branch. The “merge” command does exactly this.
In practice, merge only involves two steps for us:
- First, we have to make sure we’re on the right branch - because it’s always the current HEAD branch that receives new changes.
- The second step is just to call the “merge” command. Here, we let Git know which branch we want to integrate into our current HEAD.
Let’s do all of this in practice.
Let’s take a look at what we want achieve.
On our "feature/signup" branch, there’s work that is not yet on our "master" branch.
We’d now like to integrate any new commits from "feature/signup" into "master".
First, we need to switch to the "master" branch - because, as said before, it’s always the current HEAD branch that receives merged changes. So we check out "master" by double-clicking it.
Then, all we have to do is hit the merge button. There, we select which branch we want to integrate into our current HEAD.
You could also simply drag the branch and drop it onto your HEAD branch in the sidebar. This saves you from having to select the branch.
And that’s it. If we now look at the "master" branch’s history once more, we see that the changes were successfully integrated and are here, too.
We could now delete the signup feature branch or continue to work and merge again any time later.
Thanks for watching - and see you in our next videos!