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