So the first thing we're going to cover is cloning, cloning is a really important part of working with
remote repositories.
In fact, it's such an important thing that we do and get if we go to the documentation under reference,
all the commands are grouped together like the basic snapshot and commands adding and get status commits
branching and merging their group together.
But then up top, there are two command side by side getting and creating projects.
Annet and clone.
So we've seen how to use get Annet to create a new project or a new report from scratch.
We've done that for every repository, but get clone does something different.
Get clone actually goes and gets a repository that is not on your machine and it brings it to your machine.
It basically downloads the contents of a repository based upon some you that we provide.
Typically that you URL will be from a service like GitHub and in this course and 99 percent of the open
source projects out there, it will be a GitHub repository that you're cloning, but it could be something
else.
BitBucket it could be a self hosted repository.
Git does not care.
The command git clone is part of Ghiz.
It's not part of GitHub.
So here it is, git clone and then you url and that Yoro is where git will go and retrieve all the relevant
information for a repository from.
It will copy the files to your machine.
It initializes a new repository on your machine.
So that gives you access to the foget history of whatever project you're cloning.
And I'm going to demo this in just a moment.
So as an example, there's some repository on GitHub.
Let's say it's I don't know, it's it's react or it's a Flappy Bird clone.
It's some game on GitHub.
I want the source code and the get history.
So if I run git clone with the corresponding URL, whatever that GitHub you url is for that hosted reffo
get is going to go fetch all of that and bring it down to my machine.
I'll have the full history, all the comics, all the files.
So I'll go ahead and demonstrate this.
Here's a GitHub repository that I don't have.
It's for the game 2048 which some of you probably know this game very addictive.
It's I don't know how many years old now, but anyway, it's just a JavaScript html, some success that
it's a game.
You can open it up and play it in your browser.
So if I want the code for that and I want the full git history, of course I can see it on GitHub.
All right.
That's what GitHub is doing for me here.
As a user, I can view this URL.
I can look at different commits.
One hundred and eighty comments.
I can see who contributed.
I can read about it.
I can take a look at, you know, the index HTML file in the browser.
But I'm going to clone this YORO.
One option is just to copy this.
You are all right here.
Another option on GitHub is to click right here and it's going to show me the clone you URL, which
is the same thing.
It's really up there.
I can click this button.
I can, you know, command see however you want to get that you URL, I'm going to get that you URL.
And by the way, this repository link is in the resources with this video.
If you want to try this, definitely recommend you do.
Now I'm going to go over to my terminal.
The first thing you always want to do when you're cloning is make sure that you're not in a repository,
just like when you run, get a net.
So I just like to do get status, OK?
We're not in a repository.
And then wherever you run git clone, that is the place, that folder where Git is going to create a
new folder for you.
So I'm in a folder called What is this just.
Well, actually, I meant to be in this folder cloning.
So now I'm in a folder cloning.
There's nothing in here.
It's going to make me a new folder when I run this command, get clone and then I paste that you URL
that's coming from GitHub.
I don't have anything from this you url.
I don't have this repository on this machine.
I'm not to get rebo.
But when that finishes and you will need Internet for this, when that finishes, we see a new folder
that was not there before I typed out, there was nothing.
If I go into that folder and I type Ellas.
OK, I've got a whole bunch of stuff right.
I've got indexed HTML, JavaScript folder, style folder, some other stuff going on.
And it looks like this is a git repo.
Right.
I type git status.
Yes it is.
If I type git log I can see the full history of commis.
See how that stuff, that's all came from GitHub.
I can see all the comments and who made them when they were made.
There's, you know, all the code here.
I can open it up and take a look.
I can even run this.
And there this is actually running.
This is not the hosted version.
This is running from my machine.
You can see here and there we are.
I could play around with it myself.
I could change the styles.
I've opened up the access, main access, and I could do something like a background.
What are we doing with the background color somewhere?
There we are.
Let's make that some form of green or olive.
Sure.
Olive, just like that.
So pretend I've tweaked a whole bunch of things.
I can see those changes.
Right.
This is all just for me to experiment and play around with locally, although in the next couple of
sections I'll also show how we could make changes and then try and contribute, try and share these
changes with the owner of the repository.
Try and suggest maybe not this, but maybe there's a bug that someone's identified and I volunteer to
fix it.
I would need to clone the repository whether I'm just messing around and breaking things and playing
and changing colors, whether I'm trying to understand how something works or whether I want to make
contributions I need to clone.
So that command git clone, it's pretty simple, right?
Just get clone and then you erl make sure you're not in a git repository when you run it because it
creates well it creates a folder, but in that folder there is a git repository that's been initialized
and it has the full history of the project.
I'm just showing it to you and get crackin very quickly.
This is the clone repository and we can see a lot of comments going on as I scroll a lot of different
branches over time, a lot of different contributors.
And I could take a look at any of them.
I could go all the way back to the beginning.
Oh, boy.
Look, initial commit basic styling, the very basic stuff like add wind, wind conditions so you can
win the game all the way up to things up top where other developers have contributed.
I'll just show one more example.
This is another GitHub repository.
This one is just a list.
It's a list of companies that hire without whiteboarding interviews, without the bad computer science
trivia questions that don't actually test your abilities as a developer.
It's open source.
People contribute different companies that are on here.
If I want this repository for whatever reason on my machine, never mind the fact that, you know,
just it's probably easier to view it here.
But if I wanted to contribute an ad, I could copy this URL.
Right.
Or I can click here and copy that to the same URL, go to my terminal, which is somewhere.
There we are.
Make sure I'm not gonna get repo and I am right now.
So I'm going to back out.
And now I'm not type get status.
I'm not git clone paste that you url.
It takes a moment, this one's a bit larger, and then I have a new folder, hiring without whiteboards
get status inside.
Yes, it is a repository I type unless we can see all the files here.
And I type git log and I can see all of the contributions, all the individual commits.
There's quite a bit here.
Let's do one line.
OK, and then I can scroll through all of them, I could open this and get cracking and show you the
same thing, I have the full history for that entire repository on my machine.
I didn't create the repository.
Right.
I just cloned it using git clone.
Great command.
Excellent, excellent.
Great command.
Remember, it's a command.
It is not tied to GitHub.