-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.html
More file actions
507 lines (402 loc) · 22.6 KB
/
index.html
File metadata and controls
507 lines (402 loc) · 22.6 KB
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>ME 599: Remote Version Control</title>
<meta name="description" content="
ME 599: Remote Version Control lecture
">
<meta name="author" content="Kyle Niemeyer">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<link rel="stylesheet" href="dist/reset.css">
<link rel="stylesheet" href="dist/reveal.css">
<link rel="stylesheet" href="dist/theme/simple.css" id="theme">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="plugin/highlight/monokai.css">
<!-- If the query includes 'print-pdf', include the PDF print sheet -->
<script>
if( window.location.search.match( /print-pdf/gi ) ) {
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'css/print/pdf.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
}
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section data-markdown>
<textarea data-template>
# Remote Version Control
## Software Development for Engineering Research
### Kyle Niemeyer. 6 January 2022
### ME 599, Corvallis, OR
</textarea>
</section>
<section>
<section data-markdown>
<textarea data-template>
## Today: Remote version control (i.e., using GitHub) and Software Licenses
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## Topics for today:
- Backup up code (and any files) online
- Cloning and forking remote repositories
- Managing files in a collaboration
- Merging simultaneous changes
- Downloading open source code
</textarea>
</section>
</section>
<section>
<section>
<h2>Repositories</h2>
<br/>
<div class="floated_img">
<a href="https://github.com" class="image"><img src="./images/GitHub_Logo.png" height="100" alt="GitHub"></a>
<a href="https://launchpad.net" class="image"><img src="./images/launchpad-logo.png" height="100" alt="Launchpad"></a>
</div>
<div class="floated_img">
<a href="https://sourceforge.net" class="image"><img src="./images/sourceforge-logo.jpeg" height="100" alt="SourceForge"></a>
<a href="https://about.gitlab.com" class="image"><img src="./images/gitlab-logo.svg" height="100" alt="GitLab"></a>
</div>
<h3 class="fragment">We'll focus on GitHub.</h3>
</section>
<section data-markdown>
<textarea data-template>
## Why GitHub?
- Nice landing page—renders README automatically
- Grabs information about LICENSE, programming language
- Supports issue tracking and wiki
- Network graphs, time history of commits
- User downloads
- Varying permissions (read, write, etc.)
- Nice web interface to browse, view, and edit code
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## Workflow (with account)
1. Create space for repo on GitHub account
2. Point to that remote repo from local copy
3. Push repository to the remote location
4. Continue working!
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## Alternatively, if starting new project, you can:
1. Create a new repo on account
2. Copy (clone) empty repo to local computer
3. Prosper!
</textarea>
</section>
</section>
<section>
<section data-markdown>
<textarea data-template>
## Let's work through creating a repo
<img src="./images/github-create-new-repo.png" height="400" alt="GitHub screenshot">
</textarea>
</section>
<section>
<img src="./images/new-repo-info.png" height="600" alt="Screenshot of creating a new repo on GitHub">
</section>
<section>
<img src="./images/new-repo-info-filled.png" height="600" alt="Screenshot of creating a new repo on GitHub with info filled">
</section>
<section>
<img src="./images/new-repo-empty.png" height="600" alt="Screenshot of a new, empty repo on GitHub">
</section>
<section>
<h3>Create and push new repo</h3>
<img src="./images/github-push-remote.png" height="500" alt="Pushing to a remote repo on GitHub">
</section>
<section>
<h3>Cloning a repo</h3>
<img src="./images/github-clone-repo.png" height="500" alt="Cloning a repo from GitHub">
</section>
<section>
<h3 class="fragment"><strong>Clone</strong>: make local copy of any repository (Git)</h3>
<h3 class="fragment"><strong>Fork</strong>: Remote repository connected to/aware of the "upstream" repo it was cloned from (GitHub)</h3>
</section>
<section>
<h3>Forking a repo</h3>
<img src="./images/github-fork.png" height="400" alt="Forking a repo on GitHub">
</section>
<section>
<h3>Collaborative work using GitHub</h3>
<img src="./images/github-collaborate-forks.png" height="400" alt="Collaborating with forks on GitHub">
</section>
<section>
<img src="./images/github-clone-repo.png" height="500" alt="Cloning a repo from GitHub">
<p class="fragment">How does Fran keep local repo up to date with the original?</p>
</section>
<section>
<h3>Do this yourself</h3>
<br/>
<ol>
<li class="fragment">
Fork it: at <a href="https://github.com/SoftwareDevEngResearch/analysis_code">SoftwareDevEngResearch/analysis_code</a>, click "Fork"
</li>
<li class="fragment"> Clone your fork
<pre><code data-trim class="bash">
$ git clone https://github.com/[you]/analysis_code.git
</code></pre>
<p>(replace "[you]" with your username)</p>
</li>
<li class="fragment">Create the alias "upstream" for the remote repo:
<pre><code data-trim class="bash">
$ git remote add upstream \
https://github.com/SoftwareDevEngResearch/analysis_code.git
$ git remote -v
</code></pre>
</li>
</ol>
</section>
<section>
<h3>Fetching and merging remote content</h3>
<br/>
<ol>
<li class="fragment"> In your cloned local repo, fetch the upstream repo history:
<pre><code data-trim class="bash">
$ git fetch upstream
</code></pre>
</li>
<li class="fragment"> Merge the "upstream" main branch into your main branch:
<pre><code data-trim class="bash">
$ git merge upstream/main
</code></pre>
</li>
<li class="fragment"> Look at the changes!
</li>
</ol>
</section>
<section>
<h3>Update your fork</h3>
<ol>
<li class="fragment"> After merging upstream history, push your work:
<pre><code data-trim class="bash">
$ git push
</code></pre>
(this goes to "origin main")
</li>
</ol>
<br/><br/>
<h3 class="fragment">What if you (or someone else) made a change in your fork?</h3>
<ol>
<li class="fragment">
<pre><code data-trim class="bash">
$ git pull
</code></pre>
"pull" = "fetch" and "merge" for "origin main"
</li>
</ol>
</section>
<section>
<h3>Alternatively, use GitHub:</h3>
<img src="./images/github-fetch-upstream.png" height="150" alt="Fetch upstream on GitHub">
</section>
<section>
<h3>What about conflicts?</h3>
<br/>
<p class="fragment">When fetching, merging, and/or pulling remote changes, you may encounter conflicts</p>
<p class="fragment">To solve: just follow the directions!</p>
<p class="fragment">(In-class example)</p>
</section>
<section>
<h3>Collaborating on GitHub Best Practices</h3>
<h4 class="fragment">For one-person projects:</h4>
<ul>
<li class="fragment">push and pull (to/from origin)</li>
<li class="fragment">use branches, merge into main</li>
</ul>
<br/><br/>
<h4 class="fragment">For multi-person projects:</h4>
<ul>
<li class="fragment">Fork into a personal repo</li>
<li class="fragment">Use git fetch/merge to keep updated with upstream</li>
<li class="fragment">Push (and pull) to/from origin (your fork on GitHub)</li>
<li class="fragment">Contribute changes via pull requests on GitHub</li>
</ul>
</section>
</section>
<section>
<h3>(Some) issues that arise when using GitHub</h3>
<br/>
<h4 class="fragment">Pull Requests</h4>
<h4 class="fragment">Licenses</h4>
</section>
<section>
<section>
<h2>Pull Requests</h2>
<br/>
<p class="fragment">Modern, GitHub-based version of emailing someone a <strong>patch</strong></p>
<p class="fragment">Pull Requests (or PRs) consist of sequences of patches, based on a history of Git commits</p>
</section>
<section>
<h3>Example Pull Request on GitHub</h3>
<img src="./images/github-pull-request-example.png" height="500" alt="Pull request example on GitHub">
</section>
<section>
<h3>How to contribute a change to someone else's repository</h3>
<ol>
<li class="fragment"> Fork the repo </li>
<li class="fragment"> Clone your fork locally
<pre><code data-trim class="bash">
$ git clone ...
</code></pre>
</li>
<li class="fragment">Create a new branch for your changes/fix:
<pre><code data-trim class="bash">
$ git checkout -b newfix
</code></pre>
</li>
<li class="fragment">Commit and push your changes
<pre><code data-trim class="bash">
$ git commit -am "fixes problem in upstream project"
$ git push origin newfix
</code></pre>
</li>
<li class="fragment">Submit a Pull Request via GitHub</li>
</ol>
</section>
<section>
<h3>Create Pull Request</h3>
<img src="./images/github-create-pull-request.png" height="500" alt="Create a Pull Request on GitHub">
</section>
<section>
<h3>Submitting Pull Requests</h3>
<br/>
<p class="fragment">Try to submit shorter Pull Requests when possible, as they are easier to review and merge</p>
<p class="fragment">If the project uses testing, make sure to add a new test (or modify an existing one) to reflect your change. More on tests later!</p>
</section>
</section>
<section>
<section>
<h3>Software Licenses & Copyright</h3>
<br/>
<h2 class="fragment">Important: I AM NOT A LAWYER!</h2>
<h4 class="fragment">AKA: IANAL</h4>
</section>
<section>
<h3>Copyright</h3>
<br/>
<p class="fragment">Facts and ideas are <strong>not copyrightable</strong>.</p>
<br/><br/>
<p class="fragment"><em>Expressions</em> of ideas are copyrightable.</p>
</section>
<section>
<h3>Copyright Examples</h3>
<br/>
<p class="fragment">Game rules are not copyrightable (chess, Go, football, <em>Dungeons & Dragons</em>).</p>
<p class="fragment">Expressions of game rules <em>are</em> copyrightable.</p>
<img class="fragment" src="./images/dnd-handbook.jpg" height="300" alt="Dungeons & Dragons Player's Handbook">
</section>
<section>
<h3>Copyright Examples 2</h3>
<br/>
<p class="fragment">A function that computes standard deviation of values: name choices and concept of the function are not copyrightable.</p>
<br/>
<p class="fragment">The <code>std()</code> code actually computes the standard deviation <em>is</em> copyrightable.</p>
</section>
<section>
<h3>Basic Copyright</h3>
<br/>
<p class="fragment">"Right of First Publication": copyright automatically goes to the first creator of any creative work</p>
<p class="fragment">(Even if not explicitly specified)</p>
<p class="fragment">Consequence: if you post software to GitHub without an explicit license, then you own the copyright—even if openly and publicly visible.</p>
<p class="fragment">By default, no one else is legally allowed to use or modify your work.</p>
</section>
<section>
<h3>Software Licenses</h3>
<br/>
<p class="fragment"><strong>All</strong> software codes you make publicly available should be accompanied by a software license describing the terms by which others may use and/or modify your code.</p>
</section>
<section>
<h3>Public Domain</h3>
<br/>
<p class="fragment">Alternatively, you can put work into the <em>public domain</em>: "This work has been placed in the public domain."</p>
<p class="fragment">Free for anyone and everyone to use and modify.</p>
<p class="fragment">Literature examples: Sherlock Holmes, Frankenstein</p>
<p class="fragment">(There are some tricky issues internationally, however.)</p>
</section>
<section>
<h3>Software Licenses</h3>
<br/>
<p class="fragment">Kinds of software licenses: proprietary, and free/open source (FOSS, FLOSS, OSS)</p>
<p class="fragment"><strong>Pick an existing license. Do not create your own.</strong></p>
</section>
<section>
<h3>Software Licenses</h3>
<br/>
<p class="fragment">FOSS categories: permissive, and "copyleft"</p>
<p class="fragment"><strong>Permissive</strong> licenses: BSD 3-clause, MIT; allow further distribution under any license</p>
<p class="fragment"><strong>Copyleft</strong> licenses: GPL; require modifications to be shared under the same license ("viral")
</section>
<section>
<h3>https://choosealicense.com</h3>
<a href="https://choosealicense.com" class="image"><img src="./images/choosealicense.com.png" height="500" alt="ChooseALicense.com"></a>
</section>
<section>
<h3>Open Source Initiative licenses</h3>
<a href="https://opensource.org/licenses" class="image"><img src="./images/open-source-initiative-licenses.png" height="500" alt="Open Source Initiative Licenses & Standards"></a>
</section>
<section>
<h3>Which license to use?</h3>
<br/>
<p class="fragment">When in doubt, use a permissive license like the BSD 3-clause or MIT licenses.</p>
</section>
<section>
<h3>Copyrighting other creative works: Creative Commons</h3>
<br/>
<ul class="fragment">
<li>BY: Attribution</li>
<li>SA: ShareAlike</li>
<li>ND: NoDerivatives</li>
<li>NC: NonCommercial</li>
</ul>
<p class="fragment">Licenses: CC BY, CC BY-SA, CC BY-NC, CC BY-NC-NC</p>
<p class="fragment"><a href="https://creativecommons.org/share-your-work/">Choose a license</a>
</section>
<section>
<h3>Beyond copyright & licenses</h3>
<p class="fragment"><strong>Patents</strong>: cover ideas and concepts; modern issues with "patent trolls"</p>
<p class="fragment"><strong>Trademarks</strong>: symbols that represent a business or organization</p>
<p class="fragment"><strong>Export control</strong>: government may forbid the transfer of source code (and data, ideas) to another country or foreign national without permission</p>
<p class="fragment"><strong>HIPAA compliance</strong>: software that deals with human patients must be anonymized</p>
</section>
<section>
<h3>Long story short: pick a license when creating a project, and put as <code>LICENSE.txt</code> in your repo.</h3>
</section>
</section>
</div>
</div>
<script src="dist/reveal.js"></script>
<script src="plugin/notes/notes.js"></script>
<script src="plugin/markdown/markdown.js"></script>
<script src="plugin/highlight/highlight.js"></script>
<script>
// More info about initialization & config:
// - https://revealjs.com/initialization/
// - https://revealjs.com/config/
Reveal.initialize({
hash: true,
// Learn about plugins: https://revealjs.com/plugins/
plugins: [ RevealMarkdown, RevealHighlight, RevealNotes ]
});
</script>
</body>
</html>