-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlab_06.html
189 lines (185 loc) · 7.03 KB
/
lab_06.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<!DOCTYPE html>
<html lang="en">
<head>
<title>
Lab 6 - Version Control
</title>
<meta charset="UTF-8" />
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" />
<meta "="" content=" width=device-width, initial-scale=1.0" name="viewport" />
<meta content="A guided tour through the fundamentals of Git, HTML, & CSS" name=" description" />
<meta content="#0000ff" name="theme-color" />
<link href="manifest.json" rel="manifest" />
<link href="css/reset.css" media="screen" rel="stylesheet" />
<link href="css/screen.css" media="screen" rel="stylesheet" />
</head>
<body data-lab-id="6">
<a class="skip-to-content" href="#content" tabindex="1">
Skip to content
</a>
<main class="layout">
<nav id="index">
<p class="link-home">
<a href="index.html">
<span>Hack4Impact Starter Pack</span>
</a>
</p>
<button class="link-menu">
Menu
</button>
<nav tabindex="0">
<ol>
</ol>
</nav>
</nav>
<div id="content" tabindex="-1">
<h1 class="lab_title">
<em>Lab 6</em>
Version Control
</h1>
<h2>Goals</h2>
<ul>
<li>Learn about Version Control Systems</li>
</ul>
<h2>Version Control</h2>
<p>A version control system is a way to keep track of the changes to a file or a set of files. You can think
of version control like save states in a video game or data backups. Programmers use version control in order to
keep track of changes to our source code. This allows us to compare changes to code over time, revert to older
versions of code easily, experiment or iterate safely without fear of critical errors, and, when collaborating,
know who made what changes.</p>
<p class="note"><strong>Note:</strong> Version control is also known as source control or source code management.</p>
<h2>Local Version Control</h2>
<p>If you have ever saved a copy of a file before making changes, you've used a local version control
system. Keeping track of files this way is simple, but very error prone. Early local VCSs instead kept a
database, called a repository, of revisions and differences between files. This type of version
control is called <strong>Delta-based</strong> version control.</p>
<pre class="mermaid">
flowchart LR
subgraph local [local computer]
direction LR
subgraph database [database]
direction TB
v1[version 1]
v2[version 2]
v3[version 3]
v3---v2---v1
end
f[file]
f---database
end
classDef node font-family:monospace,font-size:14px
classDef clusters font-family:monospace,font-size:14px
classDef cluster rx:5px,ry:5px
</pre>
<p> For example, let's say you have
a file with some text.</p>
<h3 class="file-heading"><em>file.txt @ (2023-01-01 13:30:25)</em></h3>
<pre class="file">I am doing the Starter Pack!
I like Hack4Impact!</pre>
<p>Later, you make some changes to the file.</p>
<h3 class="file-heading"><em>file.txt @ (2023-01-02 12:40:36)</em></h3>
<pre class="file">I am done with the Starter Pack!
I love Hack4Impact!</pre>
<p>A Delta-based VCS would keep track of what you <del>deleted</del> or <ins>added</ins>.
Then, by adding up all the differences, versions of files saved at any point in time could be recreated.</p>
<h3 class="file-heading"><em>file.txt</em></h3>
<pre class="file"><del>I am doing the Starter Pack!</del>
<ins>I am done with the Starter Pack!</ins>
I <del>like</del><ins>love</ins> Hack4Impact!</pre>
<p class="note"><strong>Question:</strong> What are some easy errors that could happen if your local version control system was copying files
as backups?</p>
<h2>Centralized Version Control</h2>
<p>But what good is local version control if you want to collaborate with other developers? Enter, a centralized
version control system (CVCS). In a centralized version control system, an online server hosts the
<strong>repository</strong>. Individual developers would <em>check out</em> versions of files from the server to
their systems.
</p>
<p>This system was the standard of version control for many years and is still used today, however there are some
inherent risks with relying on a single database of your entire project.</p>
<pre class="mermaid">
flowchart LR
subgraph server [server]
direction LR
subgraph database [database]
direction TB
v1[version 1]
v2[version 2]
v3[version 3]
v3---v2---v1
end
end
subgraph cpa [computer a]
direction LR
fa[file]
end
subgraph cpb [computer b]
direction LR
fb[file]
end
server-->cpa
server-->cpb
classDef node font-family:monospace,font-size:14px
classDef clusters font-family:monospace,font-size:14px
classDef cluster rx:5px,ry:5px
</pre>
<p class="note"><strong>Question:</strong> What is the major risk of using a centralized version control system?</p>
<h2>Distributed Version Control</h2>
<p>Hence, the distributed version control system (DVCS). In a DVCS, every developer <em>clones</em> the entire
repository
from the online server. In the case of server death, each clone of the repository is a full backup of the
project files and the database containing the differences between past versions.</p>
<pre class="mermaid">
flowchart LR
subgraph cpa [computer a]
direction TB
subgraph databasea [database]
direction TB
v1a[version 1]
v2a[version 2]
v3a[version 3]
v3a---v2a
v2a---v1a
end
fa[file]
fa---databasea
end
subgraph server [server]
direction TB
subgraph database
direction TB
v1[version 1]
v2[version 2]
v3[version 3]
v3---v2---v1
end
end
subgraph cpb [computer b]
direction TB
subgraph databaseb [database]
direction TB
v1b[version 1]
v2b[version 2]
v3b[version 3]
v3b---v2b
v2b---v1b
end
fb[file]
fb---databaseb
end
cpa<-->server
cpb<-->server
cpa<-->cpb
classDef node font-family:monospace,font-size:14px
classDef clusters font-family:monospace,font-size:14px
classDef cluster rx:5px,ry:5px
</pre>
<p class="note"><strong>Question:</strong> Think of some advantages and disadvantages of using a distributed version control system.</p>
</div>
</main>
<script src="js/ui.js" type="text/javascript"></script>
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
mermaid.initialize({startOnLoad: true, theme: "base"});
</script>
</body>
</html>