Okay.
Here goes nothing.
I'm going to demonstrate these centralized workflow.
I'm working with the same two user accounts.
Same to get users, colts and good old Stevie Chicks.
My chicken.
Well, you can see Stevie Chicks.
That's who I'm signed in here.
Once again, pay attention to what you see up top.
That is very important to differentiate between the different users.
All right.
So I've made a repo called centralized workflow.
Colt is the owner and I've gone ahead and added Stevie Chicks as a collaborator.
As you can see here, I just fast forwarded or I didn't even fast forward.
I skipped through that part entirely because it just takes time.
I had to open the email and accept the invite as Stevie.
But anyway, we both have access.
It's a public repo for now.
It doesn't matter.
And Colt's already added a simple read me and I actually did that all in the browser.
I don't have this on my local machine, so I am going to clone this down as colt so make sure I'm not
in a git repo.
Get status.
Cool.
So get clone that url.
Okay.
So now we have that folder get status, we've got the read me and I'll open that over here.
So there's that file there and then I'll go ahead and clone the same repo down to Steve's local machine
so that we can both work on it.
Just like we would just like in the diagrams where in this centralized workflow, everybody clones or
everybody gets the same starting repo, the same remotes.
So that's what I'm going to do here.
So I'm going to copy this URL.
And then as Stevie cloned it and just as a reminder, I had to do.
I had to jump through some hoops in order to have these two different accounts and be able to clone
as separate users with different SSH keys.
So I actually did tweak my URL a bit to make this all work.
It doesn't really matter because I'm not expecting you to do it, but I just want to be very clear and
transparent about that.
I am on one machine and normally you don't have two different accounts and two different ssh keys and
all of that.
Anyway, I clone that we see centralized workflow.
Great.
And we're now working on that.
I'll open it in Stevie's editor, too.
Okay, so now we both have it.
We've cloned, we're ready to go.
So we're going to make a simple website.
I'm talking very, very simple.
And Colt is going to start it off.
Cold is going to make the index that HTML, our main file, the entry point into our app and then he's
going to add and commit that.
So we'll do a git add index, get commit dash add index HTML.
I'm doing super short and kind of terrible commit messages, but that's fine.
And then what I'm going to do is use bootstrap.
So if you're familiar with bootstrap, great.
If not, it doesn't really matter because I'm not expecting you to follow along, but I'm going to open
that HTML file and add some basic bootstrap boilerplate.
Okay.
So I put that in there and I'll add and commit that as cold.
Get add index.
Get commit.
Had bootstrap boilerplate.
All right.
So now we're going to push this up clear.
I'm going to push those two commits to Origin Main.
If we're all working on one branch, in this case, it will be the main branch.
But in the diagrams I created, it's the master branch everyone's working on, but it's the same concept.
So basically right now we're playing the role of forest, doing some commits and pushing them up.
All right, so that's what I'm going to do.
Get push origin Main.
And that goes up to GitHub.
And now if we refresh our repository we see index.html write this is now up here.
So now as Steve we definitely want to pull down those changes.
Right.
So get pull origin main just to start.
All right.
So now we have that new file index of HTML and let's get to work.
Let's say that Colt has been tasked with making a form on their web page, a simple form.
So we're just going to copy some of the forms from the documentation.
Maybe it's a form that looks like.
Sure, maybe it's just a login form.
So we're just going to copy this just to keep everything short.
So this is on Colt's machine.
We'll put this in the body, we'll add a bootstrap container.
Okay.
So this is the work.
We'll pretend this took all morning.
Colt did this work so then cold decides.
So weird saying my name in third person.
But anyway I decide it's time to make a commit.
So always check get status.
All right, get.
I'll just do a one liner.
Get dash or get commit dash am for would we do add basic to the login form that we made sure log in
form.
All right so now pushes this up he wants everyone else to to know about this so get push origin main.
Now at the same time all of this has been happening, Stevie is working on some other feature.
Stevie has been tasked with adding a nav bar.
Probably not.
Not exactly a super realistic reflection of a real workplace where one person is asked to just put a
form on a page and somebody else is asked to independently put some random nav bar on a page, and then
they're expected to combine it.
Usually there would be some sort of design process and some sort of mockup or wireframes or something.
That would be what we were trying to recreate.
But anyway, let's just say it's a free for all.
Steve has been asked to add a nav bar, so on bootstrap we can make all sorts of fancy nav bars like
this one here again, I'm just going to copy this.
Just straight up.
Copy it.
I don't want to waste your time.
So, Stevie, this is Stevie's desktop here.
Puts that in index.html.
Puts it right above everything else.
So this is Steve's work.
Let's see what it looks like if we refresh.
There's the nav bar.
Okay, so then Steve adds and commits that get add index get commit dash m add bootstrap nav bar.
So then he keeps working and then maybe he makes another small tweak.
He actually wants this to be a dark nav bar.
So on the naff bar, we can change this left nav bar or light to be nav bar dark and then give it a
dark background.
So bg dark like this.
Let's see what that looks like.
All right, so that's what Steve wants.
And then he realizes, Oh, you know what?
This is supposed to be responsive.
And it is.
Except why is this draw not working right?
He wants this draw like it does on the documentation.
Oops.
It's on this page, isn't it?
On the documentation when this collapses.
Right there.
There's this dropdown that's supposed to show up, this draw that expands, but it's not happening on
Steve's copy, and he's freaking out.
He's very junior.
I mean, he's a chicken.
He doesn't know what's going on.
So he decides, you know what?
I should just ask Colt.
He's somewhat experienced with this.
I'm going to just ask him.
I'll send him a Slack message and I'll put my code up on GitHub so you probably know where I'm going
with this.
Steve He needs to put this code on GitHub.
He wants to put this half.
I mean, it's it's working.
It's a nav bar.
It's showing up.
But for whatever reason, it's not collapsing.
He wants to share this with Colt.
So Steve goes ahead and adds and commits.
He needs to add that get add index, get commit dash m change nav bar color to dark or something.
All right, so now, Steve, moment of truth.
I'll make this a bit larger here.
Now, he pushes this code up, and we're doing this centralized workflow.
There's only one branch main.
He pushes that up.
So get push origin main.
Oh.
What does this say?
Rejected.
Oh, who saw this coming?
Failed to push some refs to blah, blah, blah, blah, blah.
Updates were rejected because the remote contains work that you do not have locally.
This is usually caused by another repository pushing blah blah blah blah.
So basically we ran into this problem.
Oh my gosh, lots of desktops right here where if we try and push something up and we don't have all
the new work from GitHub, get won't let us do that.
So we first have to pull those new commits down.
Basically, I have to get the work Stevie has to get the work that Colt pushed up to GitHub.
Oh, boy.
What a nightmare to talk about all of this.
But right.
There's these new commits.
There's five commits here.
The most recent one is the login form that Colt pushed up to GitHub.
Stevie doesn't have that locally, so we have to pull down so we can do that.
Get pull origin main.
And it could have been worse, but there were still a merge.
So we have this merge commits and it's saying merge branch, Maine, blah blah blah blah blah on into
main.
Sure.
We'll just go with that.
So this is what things now look like on Stevie's machine.
He got the changes that Colt did for this form, so now he can push up, hopefully.
Let's see.
Get status.
Yes, he's good to go.
So he can push up, get push origin main, which is what we tried to do in the first place.
Right.
We don't even have this finished nav bar.
It's still not really working.
We want to push that up.
Okay.
We go to GitHub and it does show up here.
We can see on index we have the nav bar content.
So in the meantime, it's the next day Colt shows up to work and he starts doing some other stuff.
Let's say he's just making some minor tweaks.
He's changing the form.
I don't know what he's doing to the form instead of, We'll never share your email with anyone else.
We'll always share your email with everyone.
So he's just making some changes.
And then he gets that message from Stevie saying, Hey, I just pushed up new some new code, this broken
nav.
Mark, can you try and fix it for me?
So Colt then has to decide, okay, well, I have these changes right on my master branch or my main
branch, the only branch allowed in this workflow.
Oh, you can see, it's kind of a nightmare.
I have changes that are not ready to commit.
What do I do?
I want to go get that new stuff from Stevie.
But if I try and pull right now, get pull Origin Main.
And what do we see?
Oh, it doesn't actually let me do it.
It says your local changes to the following files would be overwritten.
Please commit your changes or stash them before you merge so it doesn't even let me get the newest version,
the newest work that Steve has done.
So I need to commit or stash.
I guess we could stash, but that's fine.
So get stash.
So now I can take a look.
I can do a git pull or origin main again.
We're all just working.
We're stuck on this one branch.
All right, now I get that new commit, hopefully from Stevie.
Let's just take a look.
We have the nav bar.
It is showing up and it's not working.
Right.
I go back here, it's still broken.
And that was the point.
Stevie wanted help, and just to get help, he had to break the main branch.
Our only branch.
I mean, it's not truly broken, but he had to add this incomplete code to it.
This isn't working and it's not ready for production.
I will get in trouble from my boss.
I can't do this sort of thing.
So in the next video, we're going to talk about a much better workflow.