All right, so now it's time to get some practice on your own with the GitHub basics, creating GitHub
repositories, setting up remotes, pushing that sort of thing.
So nothing crazy here, but really the bread and butter of working with GitHub is just getting your
code up on GitHub and then as we'll soon see, getting code down, pulling down from GitHub, which
we haven't yet learned anyway.
As always, for these exercises, you can find the link to get to these instructions as a resource with
this video.
So I recommend you open that up and probably like always just pause this video and read the instructions.
If you have questions, come back to this video.
So the core idea here is that you're going to make a new repository locally on your computer, then
you'll go to GitHub and make a GitHub repository and then you'll connect the two.
Then after that you'll make a file called favorites.
TXT an empty file you'll save and you'll make your first commit.
Now this part is optional.
If you want to go with Main instead of master, I'm going to be using Main just to be consistent in
this file.
But if you choose to stay with master, then just sub that in wherever you see main so you'll make a
new file favorites.
TXT Leave it empty, make your first commit on the main branch, then push up that main branch to GitHub.
So make sure that you see your empty file on GitHub.
Then the next bit is to make two branches a foods branch and a movies branch, both based on the main
branch.
Then switch to the foods branch, add three or more of your favorite foods to the file, add and commit
your changes.
Then switch to the movies branch.
Add three or more of your favorite movies to the favorites file.
Add and commit your changes, then push up your foods branch to GitHub and make sure you see it on GitHub.
If you refresh the page and then do the same thing for the movies branch, push up the movies branch
and then we get to this step where I'd like you to merge the foods branch.
Let me fix the highlighting.
Okay, there we go.
So you'll merge the foods branch into the main branch and then you'll merge the movies branch into the
main branch.
So you should now have, after this step, a favorites file that contains both your favorites movies,
both your favorite movies and your favorite foods in the same file favorites on the main branch.
So now the main branch has changed.
GitHub doesn't have that.
So push up the latest work from that main branch, push it up to GitHub.
So that's the basic steps, right?
Make a repo, go on GitHub, make a repo, connect the two, then push up your first little commit on
the main branch, make two branches, do some work on both of them, push each of them up individually,
and then merge those branches locally into the main branch and push the main branch up again.
So please give it a shot on your own unless you are very comfortable with GitHub.
I don't know why you'd be watching this video anyway, but I know it's not the most exciting possible.
I mean, none of these exercises are going to knock your socks off, but very important basic workflow.
So I'll go ahead and do it.
I'll make a new repository locally on my machine.
Let's do it in a folder.
I'll call this favorites.
I'll seed into it and check that I'm not in a repo, I'll init a new repo and then I'll go ahead and
make my new GitHub repository.
So go to GitHub, click the plus new repository and I'll just call this 1gh favorites, exercise, name
it, whatever you'd like.
I'll keep it public if you want to take a look.
There's not really going to be much to look at, but you're welcome to.
And then I'm going to create it.
And then the next step is to connect my local repo to the GitHub repo, which really just means add
this remote.
So I'm going to add that remote and then optionally rename my master branch to Main.
We can just copy that.
Assuming that we're on the master branch or in this case we're not even on a branch yet.
So I will need to make that master branch or I will need to do some work, but then I can rename it.
So as you can see, I'm not even on a branch yet.
I don't have any commits, so there's no branch reference.
But I'll just save that line for just a moment because next we're going to make a new file called Favorites.
That text will leave it empty and make our first commit.
So touch favorites txt then we'll add it.
So get add favorites and we'll commit.
Just do something like add empty favorites file.
So now we see Master there and I'm going to rename that to Main.
Right so I type get status we see on branch main.
If I type git branch, we don't have the master branch anymore.
So if you want to go with Main, that's how you do it.
Next, we need to push up this main branch to GitHub.
Right now nothing is up here just empty.
So get push origin if that's the name of our remote and you can always check get remote be it is origin
if you just copied and pasted from github.
So git push origin and then main is my branch and if I refresh here we should see that empty file and
there it is.
So next step we need to create two branches, foods and movies.
So get branch foods.
Get branch movies.
Or I could do get switched dash C or get checkout dash B, I can switch to one of them.
So I'm going to switch to foods if I can spell that and then add two or what I say three of my favorite
foods to the favorites file.
So let me open this file.
And what are my favorite foods that did not think through this at all?
Well, one of them would have to be peppermint ice cream, not just mint chip has to be peppermint ice
cream.
It's not that common anymore.
Used to have it around Christmas as a kid.
What else?
I'm going to sound like such a fatty if I just say my honest favorites.
Soft pretzels.
Oh, I love soft pretzels.
And then I feel like I need to just lie.
How about celery?
I just love celery.
All right, so now I need to add and commit this on the foods branch.
So get add favorites, get commit to em, add favorite foods, not dudes.
And then that's it.
I could skip ahead and just push it up, but I'm going to now switch to the movies branch, get switched
to movies, and add three of my favorite movies in here.
If you've seen any of my other courses, you probably know, or at least maybe you might remember my
favorite movies.
I'm a deist.
I think I say that far too often in my course.
It's great film.
You've got to watch it if you haven't seen it.
And if you don't like it, I get it.
It's not for everyone.
But anyway, how about Fifth Element?
That's another one I like.
Not necessarily.
This is not top three movies.
Not in order.
It doesn't matter.
It doesn't matter at all.
What else?
Here's a fun one I liked quite a bit.
Captain Fantastic.
Viggo Mortensen.
Sure.
I'll say those are my favorites.
Not quite Amadeus, though.
Yeah, always number one.
Okay, so now I'm going to add those changes, get add favorites, get commit, add three of my fave
movies.
And then we get to this step.
Push up the Foods branch to GitHub.
So I can just do get push my remote origin and then the name of the branch foods.
I don't need to be on the foods branch and I'll refresh and we should see a new branch.
There it is.
And we want to verify.
We see our foods.
Whatever you put, they show up here.
Right.
And I'm currently I was looking at that file so that's where I saw this view.
You'd probably see this now push up the movies branch get push origin movies.
And refresh.
OC We see the movies branch and there we are, we see favorites and it has my favorite or some of my
favorite movies.
Then finally merge the food branch into the main branch.
So I'm going to switch to Main and then I'll just show you my favorites.
Files Empty right now.
And I'm going to merge in foods.
So get merge foods and that's just a fast forward.
That's the easy part.
Then I need to merge the moves branch into main.
Now this won't be a fast forward because now there's commits on the main branch that the movies branch
does not have.
So get merge and then movies and we get a lovely conflict.
I'm just going to select accept both changes and there we go.
We'll just leave it like this.
I could put a little heading, I guess, if I wanted that.
Said movies here, man.
I'll just leave it like that.
Anyway, I'm going to resolve the conflict like I just did.
I'm going to add favorites, and then I'll make my commit here.
What should I do?
Let's just clear get commit merge movies and foods into main.
And then finally I need to push that up.
Right.
So I don't have that latest commit on the main branch on GitHub.
If I go to it, it's just an empty file.
Very sad.
Now it's just as simple as get push.
Now, I didn't use Dash you in the previous when I first pushed the first time, so I still need to
say Origin Main.
If I had used dash u, I could just say get push.
So actually it might just figure it out on its own.
No, it does not.
Okay.
So get push origin main.
And if you have questions about that, you there's a standalone video I made on it, so you could go
check that out.
But you probably already know that.
And there we are.
So we see that we have this new commit one minute ago less than that, where we merge movies and foods
into Maine.
And on Maine we see all three on GitHub.
Foods just has the foods.
And movies just has the movies.
Oh, okay.
I need to take a break and watch one of these.
That would be nice.
With some peppermint ice cream and pretzels and not celery.
I don't like celery at all.
Really?
Bye bye.