1
00:00:00,630 --> 00:00:02,190
Instructor: In the last lesson, we looked at

2
00:00:02,190 --> 00:00:05,100
how we can push our local repository

3
00:00:05,100 --> 00:00:07,770
to a remote repository on GitHub.

4
00:00:07,770 --> 00:00:09,840
Now, in this lesson, I wanna talk about

5
00:00:09,840 --> 00:00:14,840
cloning a remote repository on GitHub to pull it

6
00:00:15,030 --> 00:00:18,720
onto your local repository on your machine.

7
00:00:18,720 --> 00:00:23,720
So this is called cloning, and the command is git clone.

8
00:00:23,910 --> 00:00:27,360
And this is a way for you to pull down all of the versions

9
00:00:27,360 --> 00:00:31,290
and all of the commits of a particular remote repository,

10
00:00:31,290 --> 00:00:35,880
and to store the files in your own working directory.

11
00:00:35,880 --> 00:00:37,650
So once you've cloned a repo,

12
00:00:37,650 --> 00:00:39,570
you've essentially made a copy of it

13
00:00:39,570 --> 00:00:42,120
on your own local working environment,

14
00:00:42,120 --> 00:00:44,730
and allows you to stand on the shoulder of giants

15
00:00:44,730 --> 00:00:47,460
and continue where they left off.

16
00:00:47,460 --> 00:00:49,260
So you won't need to clone it again

17
00:00:49,260 --> 00:00:50,580
during regular development.

18
00:00:50,580 --> 00:00:54,450
You'll continue on your own branch of that project.

19
00:00:54,450 --> 00:00:57,810
So why would you need to clone someone else's project?

20
00:00:57,810 --> 00:01:00,660
Well, it's basically so that you can have your own copy

21
00:01:00,660 --> 00:01:02,490
of a program that they wrote.

22
00:01:02,490 --> 00:01:05,489
Maybe you want to customize it to your own needs.

23
00:01:05,489 --> 00:01:08,160
Maybe the program needs to do something it currently

24
00:01:08,160 --> 00:01:11,520
doesn't do, and you want to extend its functionality.

25
00:01:11,520 --> 00:01:14,700
Or maybe you just found a bug and you want to fix it.

26
00:01:14,700 --> 00:01:17,100
So essentially it allows you to leverage

27
00:01:17,100 --> 00:01:19,620
somebody else's open source code.

28
00:01:19,620 --> 00:01:22,980
So they're putting their source code out onto the internet

29
00:01:22,980 --> 00:01:25,470
and you can simply make a copy of it,

30
00:01:25,470 --> 00:01:27,240
and continue where they left off.

31
00:01:27,240 --> 00:01:29,520
For example, a lot of people use

32
00:01:29,520 --> 00:01:32,220
self-hosted applications for their business.

33
00:01:32,220 --> 00:01:33,840
These are free versions of projects

34
00:01:33,840 --> 00:01:36,420
and services you might have to normally pay for,

35
00:01:36,420 --> 00:01:39,270
such as productivity and project management tools

36
00:01:39,270 --> 00:01:41,550
that are alternative to Jira

37
00:01:41,550 --> 00:01:45,750
or Trello or email servers like MailChimp.

38
00:01:45,750 --> 00:01:48,120
Instead of having to pay Mailchimp a ton of money,

39
00:01:48,120 --> 00:01:51,030
you can host your own email service

40
00:01:51,030 --> 00:01:53,400
or time tracking software for freelancers.

41
00:01:53,400 --> 00:01:57,600
And there's a ton, a ton, literal ton of different options

42
00:01:57,600 --> 00:02:02,430
and you can take a look through that in this GitHub README.

43
00:02:02,430 --> 00:02:04,230
Let's see how it works in practice.

44
00:02:04,230 --> 00:02:06,660
Let's clone some actual reposts from GitHub

45
00:02:06,660 --> 00:02:10,350
and run them locally to see how the entire process works.

46
00:02:10,350 --> 00:02:11,700
The command is pretty simple.

47
00:02:11,700 --> 00:02:16,470
It's simply git space clone space the url.

48
00:02:16,470 --> 00:02:19,620
The url will typically be from GitHub

49
00:02:19,620 --> 00:02:22,680
and it will look something like this.

50
00:02:22,680 --> 00:02:24,000
So what are we gonna clone?

51
00:02:24,000 --> 00:02:26,010
Well, did you know that you can run

52
00:02:26,010 --> 00:02:30,240
the original Quake video game in your web browser?

53
00:02:30,240 --> 00:02:32,250
It's entirely built in JavaScript,

54
00:02:32,250 --> 00:02:33,780
so there'll be parts of it

55
00:02:33,780 --> 00:02:35,280
that you'll be able to read through,

56
00:02:35,280 --> 00:02:36,960
and you'll be able to understand.

57
00:02:36,960 --> 00:02:38,820
But there'll be a lot of work

58
00:02:38,820 --> 00:02:40,560
that's done to create this game.

59
00:02:40,560 --> 00:02:43,530
So thankfully, we don't have to build it from scratch.

60
00:02:43,530 --> 00:02:46,623
All we have to do is just to get clone.

61
00:02:47,490 --> 00:02:51,990
I go ahead, I grab the url to clone the repository,

62
00:02:51,990 --> 00:02:55,110
and in my terminal I can write git clone

63
00:02:55,110 --> 00:02:56,823
and paste in that url.

64
00:02:58,050 --> 00:03:00,690
Now, once it receives all of the objects,

65
00:03:00,690 --> 00:03:03,360
and it gets loaded onto my own computer,

66
00:03:03,360 --> 00:03:08,360
then I can go ahead and CD into the repository quakejs.

67
00:03:08,730 --> 00:03:11,163
And once I'm inside that repository,

68
00:03:12,210 --> 00:03:15,000
I can install all of the MPM packages

69
00:03:15,000 --> 00:03:16,953
by running MPM install.

70
00:03:17,940 --> 00:03:20,940
And then the next step as they describe in the documentation

71
00:03:20,940 --> 00:03:25,410
is I need to set the content .quake.js.com

72
00:03:25,410 --> 00:03:26,670
as the content server.

73
00:03:26,670 --> 00:03:28,950
So I'm just gonna simply copy this entire line

74
00:03:28,950 --> 00:03:31,770
of commands and paste it into my terminal.

75
00:03:31,770 --> 00:03:35,100
Now, once I'm done, I can simply run the server using Node

76
00:03:35,100 --> 00:03:38,280
by again pasting this line of commands.

77
00:03:38,280 --> 00:03:40,080
And once it starts,

78
00:03:40,080 --> 00:03:45,080
you can see that web server is now listening on port 8080.

79
00:03:45,450 --> 00:03:48,060
And so now I can go to that port

80
00:03:48,060 --> 00:03:50,613
and check out the Quake jss game.

81
00:03:52,830 --> 00:03:55,560
So making sure that your url is the same

82
00:03:55,560 --> 00:03:59,040
as the one that they have set in their documentation,

83
00:03:59,040 --> 00:04:00,330
go ahead and agree,

84
00:04:00,330 --> 00:04:03,150
and you'll see once everything's loaded up,

85
00:04:03,150 --> 00:04:06,960
the original Quake game running on your browser.

86
00:04:06,960 --> 00:04:09,300
But more importantly, you are running it

87
00:04:09,300 --> 00:04:12,630
from the code that you clone from GitHub.

88
00:04:12,630 --> 00:04:15,150
So feel free to have a play around with the game.

89
00:04:15,150 --> 00:04:18,839
It's pretty cool and it's very retro.

90
00:04:18,839 --> 00:04:19,940
And there you have it.

91
00:04:21,420 --> 00:04:24,357
Now another example is Wordle.

92
00:04:24,357 --> 00:04:28,140
Wordle is basically a word game where you have to guess

93
00:04:28,140 --> 00:04:31,740
a five letter word using just six tries,

94
00:04:31,740 --> 00:04:34,140
and it went completely viral a few years ago,

95
00:04:34,140 --> 00:04:36,630
and eventually got bought by the New York Times.

96
00:04:36,630 --> 00:04:39,510
And the official Wordle is now accessed

97
00:04:39,510 --> 00:04:41,010
at the New York Times

98
00:04:41,010 --> 00:04:44,340
alongside all of their different crosswords and puzzles.

99
00:04:44,340 --> 00:04:47,970
But somebody has created all the code for Wordle,

100
00:04:47,970 --> 00:04:52,500
and we can clone it and run it on our own system.

101
00:04:52,500 --> 00:04:56,430
Again, grabbing hold of the url at the GitHub repository.

102
00:04:56,430 --> 00:04:58,020
You can see it's entirely created

103
00:04:58,020 --> 00:05:00,240
in Python and uses Tkinter.

104
00:05:00,240 --> 00:05:02,550
So all the things that we know about,

105
00:05:02,550 --> 00:05:04,380
we can head back to our terminal,

106
00:05:04,380 --> 00:05:08,133
use git clone to clone from that url,

107
00:05:09,720 --> 00:05:11,580
and then we open the folder

108
00:05:11,580 --> 00:05:14,103
and set up our virtual Python environment.

109
00:05:16,440 --> 00:05:18,330
And the reason why they created it is

110
00:05:18,330 --> 00:05:19,950
because the original game only allows

111
00:05:19,950 --> 00:05:21,240
you to play one word per day.

112
00:05:21,240 --> 00:05:24,237
But what if you get entirely addicted to Wordle

113
00:05:24,237 --> 00:05:26,250
and you wanna play more than one word per day?

114
00:05:26,250 --> 00:05:29,640
Well, you're in luck because you know how to clone

115
00:05:29,640 --> 00:05:33,030
the program and run it on your own system.

116
00:05:33,030 --> 00:05:35,400
Now all we have to do is just to install

117
00:05:35,400 --> 00:05:37,860
all of the required modules.

118
00:05:37,860 --> 00:05:40,740
And once that's done, we can click on play

119
00:05:40,740 --> 00:05:43,353
and the game will start in a separate window.

120
00:05:44,400 --> 00:05:48,450
Go ahead, have a guess, see what you have.

121
00:05:48,450 --> 00:05:53,450
And my personal starting word, top secret is usually notes

122
00:05:53,670 --> 00:05:56,520
or another word with R and T and S.

123
00:05:56,520 --> 00:05:58,800
But have fun playing with that.

124
00:05:58,800 --> 00:06:00,840
And you can dig through the code,

125
00:06:00,840 --> 00:06:02,880
you can change it from Wordle game

126
00:06:02,880 --> 00:06:04,800
to anything else you want to call it.

127
00:06:04,800 --> 00:06:06,360
Or you can change the colors.

128
00:06:06,360 --> 00:06:08,730
You can modify the code base,

129
00:06:08,730 --> 00:06:11,910
because you now own it on your own computer,

130
00:06:11,910 --> 00:06:13,470
and you can run it,

131
00:06:13,470 --> 00:06:15,390
and you can modify it.

132
00:06:15,390 --> 00:06:17,820
And you can see just how cool it is

133
00:06:17,820 --> 00:06:22,140
to be able to simply clone somebody else's entire code base

134
00:06:22,140 --> 00:06:23,910
that they've made open source

135
00:06:23,910 --> 00:06:26,223
for you to continue developing on it.

136
00:06:27,420 --> 00:06:30,390
So look through the code, open it up,

137
00:06:30,390 --> 00:06:33,480
and take a look inside the word files

138
00:06:33,480 --> 00:06:36,000
to see all of the available words.

139
00:06:36,000 --> 00:06:37,680
There's no cheating here.

140
00:06:37,680 --> 00:06:39,900
And you'll be able to see the actual code

141
00:06:39,900 --> 00:06:41,790
that makes this game run.

142
00:06:41,790 --> 00:06:44,370
So you can see it's just simple Python

143
00:06:44,370 --> 00:06:46,440
which you know all about.

144
00:06:46,440 --> 00:06:48,720
And some of these things you might not understand.

145
00:06:48,720 --> 00:06:52,710
But through studying somebody else's code and modifying it,

146
00:06:52,710 --> 00:06:56,040
it usually makes you a much better developer.

147
00:06:56,040 --> 00:06:59,610
Go ahead, try to improve your own version,

148
00:06:59,610 --> 00:07:04,020
make it a 2.0 Wordle, whatever that means to you.

149
00:07:04,020 --> 00:07:08,550
And this is a big part of your developer journey.

150
00:07:08,550 --> 00:07:11,790
One of the best ways to improve your programming skills

151
00:07:11,790 --> 00:07:15,540
is to read other people's code to understand

152
00:07:15,540 --> 00:07:18,270
what their code is doing, and most importantly,

153
00:07:18,270 --> 00:07:21,240
try to modify it just a little bit

154
00:07:21,240 --> 00:07:24,690
at the beginning and maybe a lot more in the future.

155
00:07:24,690 --> 00:07:27,840
But it gives you a way to level

156
00:07:27,840 --> 00:07:31,950
up your skillset by building on top of somebody else's work.

157
00:07:31,950 --> 00:07:36,950
And open-source code is a great way to get started.

158
00:07:37,080 --> 00:07:39,750
You can clone somebody's repository.

159
00:07:39,750 --> 00:07:41,730
Take a look at some of the more interesting ones

160
00:07:41,730 --> 00:07:46,530
that we've listed here such as Wordle or Jarvis.

161
00:07:46,530 --> 00:07:49,710
See roughly how things work and see if there are

162
00:07:49,710 --> 00:07:53,010
just small things that you might want to change about it.

163
00:07:53,010 --> 00:07:57,750
And this will lead you onto a very important step

164
00:07:57,750 --> 00:07:59,670
on your developer journey,

165
00:07:59,670 --> 00:08:04,140
which is contributing to open source code.

166
00:08:04,140 --> 00:08:06,060
Now, there's a lot of projects.

167
00:08:06,060 --> 00:08:07,410
There's even a list of projects

168
00:08:07,410 --> 00:08:12,210
on GitHub where they have curated some projects

169
00:08:12,210 --> 00:08:16,620
which are particularly welcoming to first time contributors.

170
00:08:16,620 --> 00:08:18,990
So teams which are open

171
00:08:18,990 --> 00:08:22,800
for first timers or beginners to contribute.

172
00:08:22,800 --> 00:08:26,040
And you can take a look at that by going to

173
00:08:26,040 --> 00:08:29,460
awesome-for-beginners, this particular repository,

174
00:08:29,460 --> 00:08:31,800
and take a look through the README.

175
00:08:31,800 --> 00:08:34,799
Take a look at maybe the Pandas module

176
00:08:34,799 --> 00:08:37,679
or take a look at Jarvis or matplotlib.

177
00:08:37,679 --> 00:08:39,780
You can contribute to all of these,

178
00:08:39,780 --> 00:08:42,870
but in order to know how to make a contribution,

179
00:08:42,870 --> 00:08:47,340
you need to learn about pull requests, branches, and merging

180
00:08:47,340 --> 00:08:51,420
which is exactly what we'll cover in the upcoming lessons.

181
00:08:51,420 --> 00:08:54,183
So for all of that and more, I'll see you there.

