1
00:00:00,090 --> 00:00:05,010
So the first thing we're going to cover is cloning, cloning is a really important part of working with

2
00:00:05,010 --> 00:00:06,240
remote repositories.

3
00:00:06,720 --> 00:00:12,120
In fact, it's such an important thing that we do and get if we go to the documentation under reference,

4
00:00:12,780 --> 00:00:18,840
all the commands are grouped together like the basic snapshot and commands adding and get status commits

5
00:00:19,200 --> 00:00:21,780
branching and merging their group together.

6
00:00:21,960 --> 00:00:27,390
But then up top, there are two command side by side getting and creating projects.

7
00:00:27,750 --> 00:00:29,200
Annet and clone.

8
00:00:30,000 --> 00:00:34,370
So we've seen how to use get Annet to create a new project or a new report from scratch.

9
00:00:34,380 --> 00:00:38,910
We've done that for every repository, but get clone does something different.

10
00:00:39,090 --> 00:00:46,410
Get clone actually goes and gets a repository that is not on your machine and it brings it to your machine.

11
00:00:46,710 --> 00:00:51,810
It basically downloads the contents of a repository based upon some you that we provide.

12
00:00:52,470 --> 00:01:00,450
Typically that you URL will be from a service like GitHub and in this course and 99 percent of the open

13
00:01:00,450 --> 00:01:05,220
source projects out there, it will be a GitHub repository that you're cloning, but it could be something

14
00:01:05,220 --> 00:01:05,610
else.

15
00:01:05,670 --> 00:01:09,360
BitBucket it could be a self hosted repository.

16
00:01:09,570 --> 00:01:10,680
Git does not care.

17
00:01:11,310 --> 00:01:13,370
The command git clone is part of Ghiz.

18
00:01:13,380 --> 00:01:14,780
It's not part of GitHub.

19
00:01:15,570 --> 00:01:23,130
So here it is, git clone and then you url and that Yoro is where git will go and retrieve all the relevant

20
00:01:23,130 --> 00:01:25,140
information for a repository from.

21
00:01:25,350 --> 00:01:27,210
It will copy the files to your machine.

22
00:01:27,510 --> 00:01:30,330
It initializes a new repository on your machine.

23
00:01:30,870 --> 00:01:35,040
So that gives you access to the foget history of whatever project you're cloning.

24
00:01:35,160 --> 00:01:36,780
And I'm going to demo this in just a moment.

25
00:01:37,620 --> 00:01:40,740
So as an example, there's some repository on GitHub.

26
00:01:41,010 --> 00:01:46,530
Let's say it's I don't know, it's it's react or it's a Flappy Bird clone.

27
00:01:46,530 --> 00:01:48,390
It's some game on GitHub.

28
00:01:49,110 --> 00:01:51,510
I want the source code and the get history.

29
00:01:51,630 --> 00:01:58,290
So if I run git clone with the corresponding URL, whatever that GitHub you url is for that hosted reffo

30
00:01:59,070 --> 00:02:02,610
get is going to go fetch all of that and bring it down to my machine.

31
00:02:03,120 --> 00:02:05,970
I'll have the full history, all the comics, all the files.

32
00:02:06,690 --> 00:02:08,700
So I'll go ahead and demonstrate this.

33
00:02:09,210 --> 00:02:12,300
Here's a GitHub repository that I don't have.

34
00:02:12,750 --> 00:02:20,010
It's for the game 2048 which some of you probably know this game very addictive.

35
00:02:20,370 --> 00:02:27,120
It's I don't know how many years old now, but anyway, it's just a JavaScript html, some success that

36
00:02:27,120 --> 00:02:27,840
it's a game.

37
00:02:27,840 --> 00:02:29,550
You can open it up and play it in your browser.

38
00:02:30,030 --> 00:02:35,160
So if I want the code for that and I want the full git history, of course I can see it on GitHub.

39
00:02:35,400 --> 00:02:35,630
All right.

40
00:02:35,640 --> 00:02:37,350
That's what GitHub is doing for me here.

41
00:02:37,350 --> 00:02:39,870
As a user, I can view this URL.

42
00:02:40,140 --> 00:02:41,580
I can look at different commits.

43
00:02:41,580 --> 00:02:42,600
One hundred and eighty comments.

44
00:02:42,600 --> 00:02:43,920
I can see who contributed.

45
00:02:44,070 --> 00:02:45,180
I can read about it.

46
00:02:45,540 --> 00:02:49,470
I can take a look at, you know, the index HTML file in the browser.

47
00:02:49,980 --> 00:02:52,140
But I'm going to clone this YORO.

48
00:02:52,530 --> 00:02:54,120
One option is just to copy this.

49
00:02:54,120 --> 00:02:54,990
You are all right here.

50
00:02:55,080 --> 00:03:00,540
Another option on GitHub is to click right here and it's going to show me the clone you URL, which

51
00:03:00,540 --> 00:03:01,200
is the same thing.

52
00:03:01,200 --> 00:03:01,920
It's really up there.

53
00:03:02,010 --> 00:03:03,150
I can click this button.

54
00:03:03,270 --> 00:03:07,770
I can, you know, command see however you want to get that you URL, I'm going to get that you URL.

55
00:03:08,310 --> 00:03:11,820
And by the way, this repository link is in the resources with this video.

56
00:03:11,820 --> 00:03:14,100
If you want to try this, definitely recommend you do.

57
00:03:15,030 --> 00:03:16,920
Now I'm going to go over to my terminal.

58
00:03:17,190 --> 00:03:21,270
The first thing you always want to do when you're cloning is make sure that you're not in a repository,

59
00:03:21,450 --> 00:03:22,920
just like when you run, get a net.

60
00:03:23,190 --> 00:03:25,710
So I just like to do get status, OK?

61
00:03:25,950 --> 00:03:27,270
We're not in a repository.

62
00:03:27,750 --> 00:03:33,630
And then wherever you run git clone, that is the place, that folder where Git is going to create a

63
00:03:33,630 --> 00:03:34,860
new folder for you.

64
00:03:35,070 --> 00:03:38,970
So I'm in a folder called What is this just.

65
00:03:39,570 --> 00:03:41,970
Well, actually, I meant to be in this folder cloning.

66
00:03:42,120 --> 00:03:43,470
So now I'm in a folder cloning.

67
00:03:43,920 --> 00:03:44,760
There's nothing in here.

68
00:03:45,090 --> 00:03:50,340
It's going to make me a new folder when I run this command, get clone and then I paste that you URL

69
00:03:50,850 --> 00:03:52,020
that's coming from GitHub.

70
00:03:52,530 --> 00:03:54,880
I don't have anything from this you url.

71
00:03:54,900 --> 00:03:57,270
I don't have this repository on this machine.

72
00:03:57,360 --> 00:03:58,620
I'm not to get rebo.

73
00:03:59,530 --> 00:04:05,710
But when that finishes and you will need Internet for this, when that finishes, we see a new folder

74
00:04:05,740 --> 00:04:08,680
that was not there before I typed out, there was nothing.

75
00:04:09,250 --> 00:04:12,370
If I go into that folder and I type Ellas.

76
00:04:13,060 --> 00:04:15,720
OK, I've got a whole bunch of stuff right.

77
00:04:15,740 --> 00:04:21,760
I've got indexed HTML, JavaScript folder, style folder, some other stuff going on.

78
00:04:22,210 --> 00:04:25,510
And it looks like this is a git repo.

79
00:04:25,510 --> 00:04:25,840
Right.

80
00:04:26,190 --> 00:04:27,210
I type git status.

81
00:04:27,700 --> 00:04:28,960
Yes it is.

82
00:04:29,110 --> 00:04:32,740
If I type git log I can see the full history of commis.

83
00:04:33,790 --> 00:04:37,370
See how that stuff, that's all came from GitHub.

84
00:04:37,510 --> 00:04:40,600
I can see all the comments and who made them when they were made.

85
00:04:41,650 --> 00:04:43,270
There's, you know, all the code here.

86
00:04:43,270 --> 00:04:45,010
I can open it up and take a look.

87
00:04:45,280 --> 00:04:46,450
I can even run this.

88
00:04:47,260 --> 00:04:48,880
And there this is actually running.

89
00:04:49,480 --> 00:04:50,820
This is not the hosted version.

90
00:04:50,830 --> 00:04:51,990
This is running from my machine.

91
00:04:52,000 --> 00:04:54,600
You can see here and there we are.

92
00:04:54,610 --> 00:04:56,140
I could play around with it myself.

93
00:04:56,380 --> 00:04:57,700
I could change the styles.

94
00:04:58,090 --> 00:05:05,080
I've opened up the access, main access, and I could do something like a background.

95
00:05:05,570 --> 00:05:08,410
What are we doing with the background color somewhere?

96
00:05:08,980 --> 00:05:09,460
There we are.

97
00:05:09,670 --> 00:05:14,020
Let's make that some form of green or olive.

98
00:05:14,380 --> 00:05:14,740
Sure.

99
00:05:14,950 --> 00:05:16,810
Olive, just like that.

100
00:05:17,360 --> 00:05:19,690
So pretend I've tweaked a whole bunch of things.

101
00:05:20,320 --> 00:05:21,460
I can see those changes.

102
00:05:21,700 --> 00:05:21,960
Right.

103
00:05:21,970 --> 00:05:25,870
This is all just for me to experiment and play around with locally, although in the next couple of

104
00:05:25,870 --> 00:05:30,700
sections I'll also show how we could make changes and then try and contribute, try and share these

105
00:05:30,700 --> 00:05:32,950
changes with the owner of the repository.

106
00:05:33,190 --> 00:05:39,160
Try and suggest maybe not this, but maybe there's a bug that someone's identified and I volunteer to

107
00:05:39,160 --> 00:05:39,610
fix it.

108
00:05:40,180 --> 00:05:45,340
I would need to clone the repository whether I'm just messing around and breaking things and playing

109
00:05:45,340 --> 00:05:49,900
and changing colors, whether I'm trying to understand how something works or whether I want to make

110
00:05:49,900 --> 00:05:52,390
contributions I need to clone.

111
00:05:52,960 --> 00:05:56,230
So that command git clone, it's pretty simple, right?

112
00:05:56,230 --> 00:06:01,360
Just get clone and then you erl make sure you're not in a git repository when you run it because it

113
00:06:01,360 --> 00:06:06,730
creates well it creates a folder, but in that folder there is a git repository that's been initialized

114
00:06:06,880 --> 00:06:09,460
and it has the full history of the project.

115
00:06:09,910 --> 00:06:12,460
I'm just showing it to you and get crackin very quickly.

116
00:06:12,460 --> 00:06:19,360
This is the clone repository and we can see a lot of comments going on as I scroll a lot of different

117
00:06:19,360 --> 00:06:22,300
branches over time, a lot of different contributors.

118
00:06:22,570 --> 00:06:24,350
And I could take a look at any of them.

119
00:06:24,550 --> 00:06:26,260
I could go all the way back to the beginning.

120
00:06:26,620 --> 00:06:27,190
Oh, boy.

121
00:06:27,190 --> 00:06:33,580
Look, initial commit basic styling, the very basic stuff like add wind, wind conditions so you can

122
00:06:33,580 --> 00:06:38,650
win the game all the way up to things up top where other developers have contributed.

123
00:06:39,460 --> 00:06:40,930
I'll just show one more example.

124
00:06:40,930 --> 00:06:42,790
This is another GitHub repository.

125
00:06:43,390 --> 00:06:45,130
This one is just a list.

126
00:06:45,310 --> 00:06:52,360
It's a list of companies that hire without whiteboarding interviews, without the bad computer science

127
00:06:52,360 --> 00:06:56,050
trivia questions that don't actually test your abilities as a developer.

128
00:06:56,140 --> 00:06:56,980
It's open source.

129
00:06:56,980 --> 00:06:59,260
People contribute different companies that are on here.

130
00:06:59,410 --> 00:07:05,140
If I want this repository for whatever reason on my machine, never mind the fact that, you know,

131
00:07:05,140 --> 00:07:07,510
just it's probably easier to view it here.

132
00:07:07,540 --> 00:07:11,200
But if I wanted to contribute an ad, I could copy this URL.

133
00:07:11,620 --> 00:07:11,980
Right.

134
00:07:11,980 --> 00:07:18,070
Or I can click here and copy that to the same URL, go to my terminal, which is somewhere.

135
00:07:18,100 --> 00:07:18,640
There we are.

136
00:07:19,480 --> 00:07:22,060
Make sure I'm not gonna get repo and I am right now.

137
00:07:22,270 --> 00:07:23,260
So I'm going to back out.

138
00:07:23,710 --> 00:07:25,870
And now I'm not type get status.

139
00:07:26,290 --> 00:07:29,560
I'm not git clone paste that you url.

140
00:07:31,320 --> 00:07:36,870
It takes a moment, this one's a bit larger, and then I have a new folder, hiring without whiteboards

141
00:07:37,680 --> 00:07:38,940
get status inside.

142
00:07:39,060 --> 00:07:43,710
Yes, it is a repository I type unless we can see all the files here.

143
00:07:44,160 --> 00:07:49,980
And I type git log and I can see all of the contributions, all the individual commits.

144
00:07:50,250 --> 00:07:51,150
There's quite a bit here.

145
00:07:51,180 --> 00:07:52,140
Let's do one line.

146
00:07:54,970 --> 00:07:59,410
OK, and then I can scroll through all of them, I could open this and get cracking and show you the

147
00:07:59,410 --> 00:08:03,790
same thing, I have the full history for that entire repository on my machine.

148
00:08:03,970 --> 00:08:05,440
I didn't create the repository.

149
00:08:05,570 --> 00:08:05,860
Right.

150
00:08:05,860 --> 00:08:07,720
I just cloned it using git clone.

151
00:08:07,990 --> 00:08:08,690
Great command.

152
00:08:08,920 --> 00:08:09,880
Excellent, excellent.

153
00:08:10,000 --> 00:08:10,930
Great command.

154
00:08:11,110 --> 00:08:12,700
Remember, it's a command.

155
00:08:12,790 --> 00:08:14,260
It is not tied to GitHub.
