1
00:00:02,740 --> 00:00:03,480
Hate everyone.

2
00:00:03,520 --> 00:00:08,410
Mark Price your debt slopes dot com and today we're going to talk about version control specifically

3
00:00:08,470 --> 00:00:09,720
about get.

4
00:00:10,000 --> 00:00:12,930
So let's get started.

5
00:00:12,940 --> 00:00:16,040
What I'm going to show you is kind of how version control works.

6
00:00:16,300 --> 00:00:24,040
And I want to give you a tip from now on in here into the far future as your development career progresses.

7
00:00:24,310 --> 00:00:28,980
If you are not using version control on every single project you are doing it wrong.

8
00:00:29,080 --> 00:00:34,410
OK I don't want to ever see you creating a project that doesn't have rigid control in some form or fashion.

9
00:00:34,490 --> 00:00:34,800
OK.

10
00:00:34,810 --> 00:00:35,550
That is the law.

11
00:00:35,560 --> 00:00:37,560
Put it in right now in your brain.

12
00:00:37,630 --> 00:00:39,920
Always always always use version control.

13
00:00:40,090 --> 00:00:40,990
OK.

14
00:00:41,410 --> 00:00:44,260
Not to be confused with birth control or things like that.

15
00:00:44,260 --> 00:00:46,460
This is actually really important.

16
00:00:46,660 --> 00:00:50,350
So what is birth control.

17
00:00:50,690 --> 00:00:52,200
Well let's talk about code here.

18
00:00:52,210 --> 00:00:56,220
OK so you write code and exchange programs.

19
00:00:56,260 --> 00:00:58,090
So let's talk about a document.

20
00:00:58,180 --> 00:00:59,710
Let's say we've got this document here.

21
00:00:59,820 --> 00:01:00,290
OK.

22
00:01:00,340 --> 00:01:01,530
It's an ugly document.

23
00:01:01,540 --> 00:01:02,460
It's OK.

24
00:01:02,950 --> 00:01:04,460
This is your document.

25
00:01:05,030 --> 00:01:09,910
OK you've written some code on it and actually it doesn't you have to be code it could be anything could

26
00:01:09,910 --> 00:01:12,690
be a text or whatever but we're going to talk about code.

27
00:01:12,700 --> 00:01:14,510
So you've written some code here.

28
00:01:14,690 --> 00:01:15,490
OK.

29
00:01:15,940 --> 00:01:20,010
Now if you're only one person and if you're working by yourself that's fine.

30
00:01:20,050 --> 00:01:23,750
You keep making changes to this and no one cares right.

31
00:01:23,760 --> 00:01:26,380
You just keep adding and changing it all that you want.

32
00:01:26,380 --> 00:01:32,430
How ever what happens if maybe somewhere right here you broke something.

33
00:01:32,710 --> 00:01:33,570
OK.

34
00:01:34,000 --> 00:01:41,300
And then now your 5000 lines later today 5000 lines later of code and you just realized you had a big

35
00:01:41,380 --> 00:01:42,050
bug.

36
00:01:42,370 --> 00:01:43,170
OK.

37
00:01:43,390 --> 00:01:47,290
Well now you have to dig through 5000 lines of new code to go back and find this coding.

38
00:01:47,290 --> 00:01:48,360
So this is a problem.

39
00:01:48,370 --> 00:01:51,670
You've just done a lot of work and now you're going to have to do a lot more work to find this bug and

40
00:01:51,670 --> 00:01:52,410
go back.

41
00:01:52,600 --> 00:01:53,280
OK.

42
00:01:53,470 --> 00:01:54,400
This is one problem.

43
00:01:54,400 --> 00:01:57,580
Version control can solve and I'll tell you how to solve it in a second.

44
00:01:57,790 --> 00:01:59,260
Here's the next problem.

45
00:01:59,410 --> 00:02:03,980
OK you've got a few people let's just say to people happy Sam here.

46
00:02:04,120 --> 00:02:06,030
OK that's happy Sam.

47
00:02:06,130 --> 00:02:13,200
And this one is beady eyed puppy and he's never really happy.

48
00:02:13,440 --> 00:02:14,210
OK.

49
00:02:14,350 --> 00:02:20,060
So you've got two people here this is Pete this is Sam and they've got their own code files right.

50
00:02:20,320 --> 00:02:22,470
But they're working on the same project.

51
00:02:23,100 --> 00:02:23,760
OK.

52
00:02:24,100 --> 00:02:28,240
So let's say that Sam wants to make some changes to the code base.

53
00:02:28,390 --> 00:02:30,550
OK so he he makes changes.

54
00:02:30,660 --> 00:02:30,970
OK.

55
00:02:30,970 --> 00:02:33,330
And then Pete makes his own changes.

56
00:02:33,490 --> 00:02:34,110
OK.

57
00:02:34,330 --> 00:02:38,430
Now here's the question this is the same project or building an app together.

58
00:02:38,440 --> 00:02:41,370
How does Sam get his changes over to Pete.

59
00:02:42,040 --> 00:02:44,650
He's made one two three changes and now he's mid-twentieth you change.

60
00:02:44,650 --> 00:02:45,180
Well sounds like.

61
00:02:45,190 --> 00:02:45,850
OK.

62
00:02:46,180 --> 00:02:50,430
Let's go ahead and load up Dropbox so you know Dropbox you maybe you've done this before.

63
00:02:50,440 --> 00:02:55,080
So draw box and then he handed it over to me like I made some changes.

64
00:02:55,090 --> 00:02:58,810
So Pete now has a new code file so he then opens up the code file.

65
00:02:58,810 --> 00:03:01,480
So he he opens up this code file here.

66
00:03:02,050 --> 00:03:06,190
And then what he does is he grabs the changes he finds all the changes that were made and then he puts

67
00:03:06,190 --> 00:03:07,520
them here in his code.

68
00:03:07,720 --> 00:03:09,660
OK.

69
00:03:09,790 --> 00:03:12,760
And he mixes them in and he's like OK I put your changes in the code.

70
00:03:12,760 --> 00:03:18,170
Now now I need to give you the latest Fosset MP sends over the combination back to Sam.

71
00:03:18,490 --> 00:03:22,110
OK here's the new file with all of Sam and these changes in it.

72
00:03:22,120 --> 00:03:25,470
And then that's going to go ahead and overwrite this.

73
00:03:25,990 --> 00:03:31,140
And then if you've got a third person here let's say pointy nosed.

74
00:03:31,360 --> 00:03:39,570
Sally joins the project on her B-D angry eyes.

75
00:03:39,610 --> 00:03:41,340
She will go up on the wrong side of the bed.

76
00:03:41,500 --> 00:03:43,410
So she now joins the project.

77
00:03:43,600 --> 00:03:50,110
So now you've got people transferring code OK to all the different players on the team.

78
00:03:50,110 --> 00:03:51,720
Does that make sense.

79
00:03:51,720 --> 00:03:52,800
And we've got this big mess.

80
00:03:52,810 --> 00:03:54,010
Who has the latest version.

81
00:03:54,020 --> 00:03:54,760
Blah blah blah blah.

82
00:03:54,760 --> 00:03:58,030
That's that's how it used to be a long time ago a long time ago.

83
00:03:58,180 --> 00:03:59,610
Do you think that's effective.

84
00:03:59,850 --> 00:04:01,270
Oh that's terrible.

85
00:04:01,270 --> 00:04:02,410
This is all bad.

86
00:04:02,530 --> 00:04:05,810
KATE PLUS you're manually taking these changes inserting them.

87
00:04:05,850 --> 00:04:06,970
Oh it's nasty.

88
00:04:06,980 --> 00:04:08,800
So this is not what we want to do.

89
00:04:08,800 --> 00:04:15,340
Problem one is saving your files if you have problems going back and be unable to revert and find those

90
00:04:15,340 --> 00:04:16,010
issues.

91
00:04:16,210 --> 00:04:23,590
And then you've got this whole issue here with multiple people on the same team DOS version control

92
00:04:23,740 --> 00:04:24,670
was created.

93
00:04:24,900 --> 00:04:25,530
OK.

94
00:04:25,630 --> 00:04:31,150
And what version control is is the controlling of versions of documents.

95
00:04:31,400 --> 00:04:38,320
OK so let's talk about scenario one with your code backup files if someone has used a version control.

96
00:04:38,320 --> 00:04:41,010
Let's go back to Scenario 1 so make a new person here.

97
00:04:41,080 --> 00:04:42,300
Keep it interesting.

98
00:04:42,310 --> 00:04:44,280
This is Jerry.

99
00:04:45,250 --> 00:04:46,920
And Jerry has code.

100
00:04:47,130 --> 00:04:49,620
And now let's say Jerry's using version control.

101
00:04:49,810 --> 00:04:57,250
So he makes change one day to his document and it's saved changed to it's saved.

102
00:04:57,490 --> 00:04:59,630
And we're going to call these actual committees.

103
00:04:59,650 --> 00:05:03,890
That's the that's a phrase that you'll use with version troll especially in regards to get.

104
00:05:04,080 --> 00:05:05,770
So he's making comments right.

105
00:05:06,060 --> 00:05:07,350
So he's committing.

106
00:05:07,980 --> 00:05:12,700
So what he's doing is every time he's making a change he's now committing to version control.

107
00:05:12,850 --> 00:05:18,570
It's being committed Now let's say he comes a version for and he finds a bug here it's like oh my gosh

108
00:05:18,960 --> 00:05:20,120
what's going on here.

109
00:05:20,310 --> 00:05:23,970
Well now what he can do is he can go check out.

110
00:05:23,970 --> 00:05:25,330
It's called checking out.

111
00:05:25,500 --> 00:05:28,340
You know like when you're checking out a girl.

112
00:05:28,540 --> 00:05:30,060
Whatever.

113
00:05:30,570 --> 00:05:33,110
Except in this case you're checking out code.

114
00:05:33,330 --> 00:05:34,380
Not really related.

115
00:05:34,380 --> 00:05:39,360
Anyway he's checking out where he wants to check out a previous commit because he wants to locate worst

116
00:05:39,390 --> 00:05:41,780
problem is what he can do is he can actually check out.

117
00:05:41,910 --> 00:05:43,760
Let's say right here number three.

118
00:05:44,160 --> 00:05:49,290
And then he can run his code his code is restored back to that previous version and he can say OK the

119
00:05:49,290 --> 00:05:50,910
bug still exists here.

120
00:05:51,060 --> 00:05:52,340
So that is not where it happened.

121
00:05:52,350 --> 00:05:57,990
And then he can check out another one another previous commit and he's like OK the bug is gone here.

122
00:05:57,990 --> 00:06:03,990
So then what he can do is he can analyze the differences between those two cochain does he doesn't have

123
00:06:03,990 --> 00:06:06,540
to go back to the 5000 lines of code to find where the problem is.

124
00:06:06,540 --> 00:06:11,040
He can analyze it between the last two changes there where his problem was and let's say that it was

125
00:06:11,040 --> 00:06:11,870
a small problem.

126
00:06:11,940 --> 00:06:15,540
Well he may not want to fix it here he can go back up here but he knows where it is now and then he

127
00:06:15,540 --> 00:06:19,500
can fix that problem or he could just take it out of this altogether.

128
00:06:19,650 --> 00:06:21,920
And then you might have cascading problems down through here.

129
00:06:21,920 --> 00:06:27,810
But regardless the point is you can now easily solve his problem because he can check out previous versions

130
00:06:27,810 --> 00:06:29,090
of his code.

131
00:06:29,100 --> 00:06:32,340
Also this is important here besides just checking our previous code.

132
00:06:32,340 --> 00:06:34,230
This allows you to have multiple versions.

133
00:06:34,320 --> 00:06:36,230
OK multiple versions of your application.

134
00:06:36,270 --> 00:06:37,680
It's like saving backups right.

135
00:06:37,710 --> 00:06:38,410
Saving backups.

136
00:06:38,410 --> 00:06:39,750
That's what this is so this is safe.

137
00:06:39,750 --> 00:06:42,910
This is much better than the first scenario we're talking about.

138
00:06:43,100 --> 00:06:43,880
OK.

139
00:06:44,220 --> 00:06:47,080
Now let's talk about the other scenario where we have multiple people.

140
00:06:47,100 --> 00:06:47,700
OK.

141
00:06:47,850 --> 00:06:50,880
So this guy here so happy.

142
00:06:51,000 --> 00:06:52,100
He loves the code.

143
00:06:52,170 --> 00:06:52,590
All right.

144
00:06:52,620 --> 00:06:54,260
And he's got his code here.

145
00:06:54,990 --> 00:06:56,400
And then let's go over here.

146
00:06:56,820 --> 00:06:59,490
And this guy's name is Sam too.

147
00:06:59,910 --> 00:07:04,070
But this is sinister Sam.

148
00:07:04,320 --> 00:07:09,320
He plays online games and thinks is real cool but I have the handle his code.

149
00:07:09,360 --> 00:07:19,500
And then what we've got down here is you've got this guy and this is Harry and Harry has his own CO-2.

150
00:07:19,920 --> 00:07:21,170
OK how do we solve this problem.

151
00:07:21,180 --> 00:07:24,010
You have any ideas where does version control come into play.

152
00:07:24,090 --> 00:07:25,580
Well let's take a look at this.

153
00:07:25,590 --> 00:07:28,510
So let's say Jim mix changes 1 2 and 3.

154
00:07:29,190 --> 00:07:31,670
And Senator Sam makes changes one to three.

155
00:07:31,780 --> 00:07:33,570
And let's say Harry.

156
00:07:34,000 --> 00:07:37,970
Well Harry sucks at coding so he only made one change and it wasn't really good.

157
00:07:38,400 --> 00:07:43,300
And anyway so you've got these three these three people here i'm just had no one sucks.

158
00:07:43,300 --> 00:07:45,270
Coney's practice you get better over time.

159
00:07:45,630 --> 00:07:49,100
And you're like thanks for de-motivating me.

160
00:07:49,130 --> 00:07:50,310
So they've all made their changes right.

161
00:07:50,310 --> 00:07:53,200
Remember how before we had to swap documents all that kind of stuff.

162
00:07:53,200 --> 00:07:57,540
Well now what we can do is Jim can now commit.

163
00:07:57,610 --> 00:08:00,480
OK so he's made these three commits these three commits these treatments.

164
00:08:00,480 --> 00:08:05,610
He can now push them up to a server OK or some location whatever it doesn't matter it's arbitrary.

165
00:08:05,610 --> 00:08:10,630
The location is arbitrary but let's just call this the let's just call this the server for right now.

166
00:08:10,800 --> 00:08:11,400
OK.

167
00:08:11,400 --> 00:08:14,820
So what he can actually do is he can push these changes here.

168
00:08:15,030 --> 00:08:15,910
OK.

169
00:08:15,960 --> 00:08:20,270
And then what happened is that he can actually pull down those changes.

170
00:08:20,410 --> 00:08:22,950
OK so he can recall this kush.

171
00:08:23,040 --> 00:08:25,910
So Jim can push sinister Samkon.

172
00:08:25,970 --> 00:08:31,470
Paul what happens is it's going to pull those changes and what it's going to do is it's going to automatically

173
00:08:31,680 --> 00:08:36,900
inject those changes where they need to go in Sam's code automatically he's going to inject them in

174
00:08:36,900 --> 00:08:37,510
there.

175
00:08:37,680 --> 00:08:42,780
And if there's no conflict meaning if no one edited the same line of code at the same time it's called

176
00:08:42,780 --> 00:08:46,530
a merge conflict we'll talk about that later on in the lessons.

177
00:08:46,530 --> 00:08:50,170
But do you automatically and inject them right in there.

178
00:08:50,530 --> 00:08:51,010
That's cool.

179
00:08:51,040 --> 00:08:51,710
Now that's Pold.

180
00:08:51,720 --> 00:08:57,090
And now with those things merge this is called a merge so centrist that sinister Sam has now merged

181
00:08:57,480 --> 00:08:58,890
those changes merged.

182
00:08:59,010 --> 00:09:04,840
Now what he can do is he can actually push the merge back to the server so the server is now up to date

183
00:09:04,920 --> 00:09:07,280
with Jim's and sinister stamps code.

184
00:09:07,440 --> 00:09:08,600
And now Harry.

185
00:09:08,720 --> 00:09:09,190
OK.

186
00:09:09,270 --> 00:09:11,640
He can actually pull down all of their changes.

187
00:09:11,650 --> 00:09:14,690
So he's polling and it's going to inject them all in here.

188
00:09:14,700 --> 00:09:16,130
Boom boom boom boom.

189
00:09:16,590 --> 00:09:17,210
OK.

190
00:09:17,430 --> 00:09:22,420
And then once those are merged Harry can now push all the changes back up.

191
00:09:22,440 --> 00:09:25,470
And now the server has everyone's code changes.

192
00:09:25,470 --> 00:09:28,080
No one had to swap files in to happen automatically.

193
00:09:28,160 --> 00:09:32,670
The pushing in the polling like I drew it out here but really you could literally if everything worked

194
00:09:32,670 --> 00:09:36,960
out the way it was you could literally major changes pull down someone else's change just merge them

195
00:09:36,960 --> 00:09:43,020
in and push them back and you could do that within a couple of minutes for less seconds even so we went

196
00:09:43,020 --> 00:09:47,160
from this massively crazy process of managing people's code to working automatically.

197
00:09:47,160 --> 00:09:50,800
Everyone's so happy even sewer system is starting to break out somehow.

198
00:09:51,050 --> 00:09:51,650
OK.

199
00:09:51,840 --> 00:09:54,830
Devious smile but because you put a bug in the code.

200
00:09:54,840 --> 00:09:58,610
But anyway so version control very very powerful.

201
00:09:58,650 --> 00:09:59,280
OK.

202
00:09:59,310 --> 00:10:05,490
Never ever ever ever ever write any code any more on any project if you don't have birth control and

203
00:10:05,490 --> 00:10:10,140
of course the most popular version control system right now is called Get g t.

204
00:10:10,170 --> 00:10:17,790
There are other systems suggest mercurial perforce SVM things like that and some larger companies are

205
00:10:17,790 --> 00:10:22,720
still using those but get is blowing away the world right now it's fantastic.

206
00:10:22,860 --> 00:10:24,830
And that's what we're using in these lessons here.

207
00:10:25,110 --> 00:10:27,730
And it's not that hard.

208
00:10:27,810 --> 00:10:30,580
Even a beginner can get up and running with it fairly quick.

209
00:10:30,600 --> 00:10:38,160
So that's version control that's get started to make sense starting to get your brain wrapping around

210
00:10:38,160 --> 00:10:38,860
the concept.

211
00:10:38,890 --> 00:10:44,130
What in the end what I want you to think about is just imagine having multiple versions of a file and

212
00:10:44,130 --> 00:10:47,510
a system that manages that for you so you never have to copy and paste again.

213
00:10:47,640 --> 00:10:52,380
And because the more you have to do copying and pasting the more air prone your code becomes and you

214
00:10:52,380 --> 00:10:54,360
never ever want any code.

215
00:10:54,360 --> 00:10:54,840
So that's it.

216
00:10:54,840 --> 00:11:01,200
Mark Price and Dev slopes does come move forward and remember to get your free life help go to death

217
00:11:01,200 --> 00:11:05,340
slopes dot com and click on the chat room with thousands of students and they're helping each other

218
00:11:05,340 --> 00:11:05,990
out.

219
00:11:06,000 --> 00:11:09,830
Also click on the forums this is where you can search for answers to your coproduct.

220
00:11:09,840 --> 00:11:12,180
You can also post your own issues so head on over now.

