Up and Running with Git Transcripts
Chapter: Teamwork: Branches
Lecture: Merging feature into the main branch
0:00 It's time to take our feature and put it into the app.
0:04 We had to do a couple of steps but we've tested it,
0:07 everyone's code reviewed it. It's good to go,
0:09 I'll show you four ways in which we can merge it and there are more.
0:13 So first of all we could go over to the git hub repository and we could
0:18 do this thing. It says,
0:20 do you want to compare and create a pull request?
0:22 Which is going to then create a merge,
0:25 Do the merge, we could do that but we have the whole next chapter coming
0:29 on pull requests. So I'm not going to do that over here on this feature
0:36 is we could switch back to our main,
0:39 it's important to this first and then we can go to the this section here.
0:43 Our branch and say we want to merge if you want to merge that into the
0:51 current branch, make sure the current branch is where you want it to go.
0:54 So I checked out. Main,
0:57 it merges immediately. Okay, we could do that but we're not going to let
1:03 me undo that check out. So now we're back on here for the other tools
1:08 and it started in the same location in
1:11 VS Code notice it's MK/eature based uh feature biased computer.
1:18 I could switch over to main.
1:23 Check out main and then go branch merge.
1:28 Select the branch to emerge from and then I can go pick I want to emerge
1:32 from the bias computer into main.
1:36 So that's one. Let's go and check out our biased version once again to put
1:41 it back and then finally over here in PyCharm down here on the right,
1:48 we've got our feature branch show again,
1:50 we want to go back into the branch.
1:52 You almost always in every scenario.
1:55 I'm showing you you want to be in the destination branch.
1:58 So we want to check out main because what's going to happen is we'll do emerge
2:02 into there and then we need to commit that merge into the branch.
2:06 It wants to go to that's main.
2:08 We're gonna say check out main.
2:10 And then here we can click once again go to this feature branch and say not
2:14 check out but merge. MK feature biased computer branch into main.
2:19 So I'm gonna click this notice right here.
2:22 This is 2-2. This is a local change that is ahead of that branch.
2:27 So it should stay but we should get that line right there changing.
2:33 So try to put these both on the screen.
2:35 That should stay because that's future work.
2:37 That's already been done. This should change because that's the feature we've added.
2:40 And let's see how this goes merge into this branch in the current boom Still 2-2
2:47 awesome. But now we have to get computer role with the fantastic implementation
2:53 of the biased towards SS. All right,
2:57 let's go ahead and run it and make sure it still works.
2:59 So it's 22. And is it biased towards S.S
3:02 I don't know, but it's getting lizard to find out.
3:05 Uh computer. What are your role?
3:06 You're throwing scissors? You're throwing scissors,
3:08 you're throwing lizards, Okay That they really beat us bad anyway.
3:14 It looks like it's working runs fine and if we go look at the pending changes
3:20 there are no changes because they were committed but if we look at what needs to
3:24 be pushed, how interesting what needs to be pushed are all the aspects of that
3:29 feature that we've added biased role in place more work on the feature,
3:34 remove logging, you could even double click here to see what it was.
3:37 Yeah there's the logging that's gone on this one biased role.
3:42 Ah Here you can see that that changed and then this changed down here.
3:47 So when we push our feature branch in it's going to do all the changes plus
3:51 this merge that happened here that basically kept some of the pieces from each side.
3:57 Alright, let's push it. Our feature is complete and has now brought back into
4:02 the main line of the application but we're able to sidestep through this branch,
4:06 do all the work until it was really truly ready to test it out.
4:10 Had logging, took the logging back out and so on.
4:13 Let's just look one more time at how things look visually.
4:21 There we go. That looks a lot like the picture that we drew before,
4:23 didn't it? So here from 1 to 1.1.
4:27 This is our feature branch that kicked off to the side.
4:29 Sorry, this is our bug fix that kicked off to the side.
4:32 This where kicked off and did some work,
4:34 did some work, did some work and then when it was ready came back,
4:37 that is our feature branch. So entirely different reasons for branching,
4:42 So entirely different considerations. Right?
4:45 This, we just want to create a fix and it's going to be abandoned.
4:48 This one, we want to just coordinate work with the goal of eventually bringing that
4:52 change back into the mainline awesome feature added.