Welcome back.
Let's continue from our previous video to talk about a more advanced workflow and get and get hub now
up to this point.
Both Marcy and I have just been working on over here.
Branch Master what does that mean.
Well it says branches but I only see master here and you might have noticed one issue with the way that
we were doing things.
That is if it's my first day on the job and I just change the title.
But maybe we'd even want that change.
Maybe that breaks our branding or breaks our app.
But I was able to do it so easily to change it into master.
Maybe Marcy didn't even know that I've added that change.
And that's a big problem right.
You don't want to put things into what we call production into what the user sees.
If it's going to break our Web site if you're a big company like Facebook that could mean millions of
dollars in lost revenue even if you have a bug that lasts a few hours so I'm going to show you a more
realistic workflow that you'll have.
And that is with branching to show you what I mean I have over here a visual of what good is really
really good.
Up until now we've been working on what we call master that is the master branch think of the master
branch as the authority.
This is the right way that our app or our Web site should look and up until now.
When I did the cool background title Well I went from background generator to cool generator.
And then when Marci changed it to capitalized letters then we went to here and we just went in a linear
fashion from one end to the other to the other to the other.
But like I said that is a bit of a problem.
So a better thing to do is what we call branching if I wanted to change the title I will create a branch
and just call it little feature for example.
And I just work on that branch on my own without affecting the master branch what the user sees only
when it's finished.
When Marci has reviewed it when we have tested it and everybody on the team is OK then we bring it back
into master and you can see over here with the big feature you can keep going for a long time on your
own branch and only when you're done do what we call merge into master.
I'm going to show you how that works today.
I'm going to close this and remember our example we have Marcy's computer here with all the files and
we have my computer here with all the files we both have our workstation setup and now you see what
Master in my terminal means and I'll show you in the notes afterwards how you can have this setup.
So it tells you what branch you're on but we can see that we're both on Master.
That's my computer.
And Marcy's computer is also on Master.
We want to make sure that we're both up to date with the latest GitHub.
So Marcy's gonna do get pull and I'm also going to do get Paul
and let's say that I'm now working on a new feature and because it's a better workflow not to work on
Master and this is a good tip generally don't work on master always branch off if I do get branch they'll
show me that well I only have one branch and that is master but we can add to it and we can say get
branch new or little feature.
And now if I do get branch I see that I have little feature but Master is highlighted because I'm currently
a master.
So the way I would go to the little feature branch I'll say get check out little feature and there you
go switch to branch a little feature and now I'm on little feature branch.
So what I've done is I've branched off of master and now created a little feature let's create a bit
of a change I'm going to say in the little feature we're going to change the current RSS background
title to say this is the background
I'm going to save here and again I do my simple workflow that we did in the last video get status I
see that yeah we have the index that a simple change point clear so we can see.
So now that we've made this change let's do get add and again just get status to make sure everything
went through.
Yeah we're ready to commit index out a symbol.
So we'll do get commit message we'll be changing text perfect.
Let's clear that.
And now again in order to let get have know of the changes we need to get push.
So we'll do get push
let's go to get hub and see what happened we see that now we have this a yellow bar that just showed
up and says You recently pushed branches so if I click on this green button here compare pull request
it shows me what changes I have which is I've changed a title and here I can let Marci know saying Marci
I've changed the text.
What do you think and I click on Create pull request
and now I have my PR and you see here how says merge pull requests.
Well if we go back to our diagram I've created this little feature and now I'm saying Hey Marcy I've
just done this new change.
What do you think.
Is it OK for me to merge it into M..
And what will happen here most likely is Marcy's will come see this pull request.
You can see that we're on the pull request apps so she'll be able to see them and seeing oh Andre just
did this change she'll look through the changes and she'll say hmm hmm well if she likes this she can
be like looks good she can click on Start a review and you know what she would like says Look she's
just going to approve
now Marcy or myself.
Usually you don't want to merge your own poll requests somebody on the team does it can now just say
March poll request confirm merge.
And there you go sometimes like deleting the branch afterwards so you can just click delete here if
I go back to the code.
Well I don't have the branches anymore because I just deleted it but in my master if I go to index out
a symbol I see this is the background.
So now Marcy can go to her project and say get pull
and again she has the latest update.
Now let's talk about some conflicts second arise.
Now let's say Marcy wants to change something and I also change this same thing and we get a merge conflict.
Let's see what happens.
So let's say Marcy wants to change create a new feature saying we'll call this one big feature and she'll
say get check out or get branch.
Big feature she'll say get check out big feature and if I do get branch we see that there's a new branch
here.
Let's clear that and she'll say here that she wants to change this back to background color or background
generator because all the users are complaining that the title changed and they like the all time.
So she's changed that.
She has done the get ad get to commit
reverting back to old title perfect and then she's going to do get push.
Let's clear that first actually.
And we do get push first time you get this you might get this Sara saying that there's no upstream you
just copy the code that they give you here.
Perfect.
Now if I go back to background generator I see the big feature pull request over here and just to show
you that you can have multiple comments.
Let's say Marcy decides to.
Oh this is me.
Marcy decides to add an exclamation point here.
She can just say again she saves this.
That's clear she'll say get ad get connect.
You do this a lot so you get really really good a get after working the company for a while.
And she'll say added X exclamation whoops I want I want to do get commit
commit added exclamation
and she'll do get push again.
Let's go back to get up if we look at the pull request they'll actually have both of these vert back
to all title and added exclamation.
And we see over here both of the changes create the pull request needs changes.
ANDRE
So while this pull request is out there I decided to start a new branch call.
Let's just call it conflict for now
and I'll get check out conflict
now in the conflict branch I decided to change this to just completely remove the call generator.
I save that again I check my status and index start a simple file has been changed.
So while this is happening I get Marcy to merge the pull request so she's entered into M..
Her parole request is in and now if I go back to my conflict I do get status and we have to add these
so get ad then get commit.
I'll just do a short message here.
Just check and now if I go back to master I have to do get checkout master again before I push my changes
I want to make sure that I have the latest version of a master so I'm not changing anything I won't
have any conflicts so I'll do get pool to get the latest and now I go to get check out conflict branch
and I can do this command get merge master so I'm saying merge whatever Zen Master into conflict
Marcy has been working on the big feature and she's merged it.
So now Master has the big feature branch.
I've also created another branch and I've been working on my own on the conflict branch and the conflict
branch doesn't know anything about master so I'm saying hey whatever is in master right now which includes
the big feature that Marcy worked on.
Pull it in and make sure that there's no conflict.
So I do that and oh I get conflict merge conflict and index not a shame offer.
Now if I actually click on Sublime Text let me open the subsidy can see a better oh boy I get this weird
little syntax it's overwhelming at first but it's easy to see what happening head is where my branches
at.
And it shows me that here to the end I don't have the H one anymore but in the master branch we have
background generator now I can talk to Marcy and say Hey Marcy do you want to keep the back on generator.
Title and she'll say yes.
That was the right thing to do.
Don't change the background.
Well in that case I just remove these lines
and remove this and save now if I do get status now OK.
We have the modified status here.
Let me just make this smaller again so you can see.
Let me clear this.
What we do now is we have to do get ad again because we made those changes and we have to do get commit
fixing the merge issue.
And I forgot the MLS share that again
conflict fixing marriage issue.
Let's clear here and do get status nothing to command working to clean.
And if I do get push Well again I get this error.
But I want to show you this time around if I didn't get the push origin conflict
it now works.
Let's go back to get hub see what sort of things we have.
We have the conflict branch and if we look at the conflict branch now well there's nothing changed because
well I just reverted all my changes so it's completely empty.
There's no changes now so Marcy would be like hey did you mean to to make this PR.
It's empty I'll see this message on my PR and I can keep going.
And that's pretty much the workflow that you'll see in get a lead the commands for you after this but
you see it's very very nice to work with you learn a few commands and as long as you have this visual
model of every time you're working on something you always create a branch you title it with whatever
feature you're working on and every once in a while you want to pull master and merge master into your
branch to make sure that you're not missing out on any updates that other developers or teammates have
done once you're done with your feature.
You make a pull request by doing get push and that pull request your add comments and people will review
your file changes and if they want you to make a few changes then you can do again get add get commit
finally make your changes and then you can merge pull request and once that's done then everybody else
on the team.
There's now a new master.
So everybody else on the team should do get Paul as well.
It does takes a bit of time to get used to but is a really really nice workflow to make sure that everybody
on the team works on the same files same projects without causing any errors and making sure that everybody
collaborates.
Well and that's it.
Hope you found this useful.
I'll see you in the next one.
Bye bye.