-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathindex.html
More file actions
590 lines (505 loc) · 21.1 KB
/
index.html
File metadata and controls
590 lines (505 loc) · 21.1 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
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Intro to Git/GitHub — Vermont Works for Women, Step Up to IT</title>
<meta name="description" content="Presentation on Intro to Git/GitHub for Vermont Works for Women Step Up to IT">
<meta name="author" content="Rachael Arnold">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="reveal/css/reveal.css">
<link rel="stylesheet" href="reveal/css/theme/white.css" id="theme">
<!-- Code syntax highlighting -->
<link rel="stylesheet" href="reveal/lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<!--[if lt IE 9]>
<script src="reveal/lib/js/html5shiv.js"></script>
<![endif]-->
<style>
.reveal img.plain { border: none; box-shadow: none; margin:0; }
.reveal p + img.plain, .reveal p + pre { margin-top: -1em; }
.reveal code span { color: lime; }
.columns { margin-left: 0; }
.columns li { list-style-position: inside; }
.columns-count-2 { -webkit-column-count: 2; column-count: 2; }
.columns-count-3 { -webkit-column-count: 3; column-count: 3; }
</style>
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h1>Intro to Git and GitHub</h1>
<h3>Version Control and Collaboration for Any Project</h3>
<p>
<small><a href="http://www.rachaelarnold.com">Rachael Arnold</a> • <a href="http://twitter.com/raevenfea">@raevenfea</a> • <a href="mailto:rae.arnold@gmail.com">rae.arnold@gmail.com</a></small>
<br>
<small>Vermont Works for Women • Step Up to IT</small>
</p>
</section>
<section>
<h2>What is <img src="images/git-logo.png" height="100" alt="Git" style="vertical-align:middle;" class="plain">?</h2>
<p>Git is an open-source, <strong>distributed version control system</strong>. It:</p>
<ul>
<li>tracks changes to documents</li>
<li>makes collaboration easy</li>
<li>keeps copies on every users’s computer</li>
<li>makes recovering previous changes possible</li>
<li>helps with worry-free experimenting</li>
<li>and more…</li>
</ul>
</section>
<section>
<section>
<h3>Interacting with Git</h3>
<p>Graphical User Interface (GUI)</p>
<img src="images/git-gui-screen.png" class="plain" alt="GitHub for Mac">
</section>
<section>
<h3>Interacting with Git</h3>
<p>Command Line Interface (CLI)</p>
<img src="images/git-cli-screen.png" class="plain" alt="Git in Terminal">
</section>
</section>
<section>
<h2>What is <img src="images/github-logo.jpg" height="75" alt="GitHub" style="vertical-align:middle;" class="plain">?</h2>
<p>GitHub is a web-based host for Git <strong>repositories</strong> and:</p>
<ul>
<li>allows users to collaborate</li>
<li>makes open-source code changes simple</li>
<li>has a built-in bug tracker</li>
<li>hosts simple websites from your repositories</li>
<li>and much, much more…</li>
</ul>
</section>
<section>
<section>
<h3>Interacting with GitHub</h3>
<p>Browser (<a href="http://github.com">GitHub.com</a>)</p>
<img src="images/github-home-screen.png" class="plain" alt="GitHub Home Screenshot">
</section>
<section>
<h3>Interacting with GitHub</h3>
<p>Browser (view of a project page)</p>
<img src="images/github-screen.png" class="plain" alt="GitHub Screenshot">
</section>
</section>
<section>
<h2>Keeping it all straight:</h2>
<p>We're using GitHub’s GUI for Git in this workshop. <br>A bit confusing, right? If it helps:</p>
<p><strong>Things in the desktop application:</strong> <br>Git <br>(all about version control)</p>
<p><strong>Things in the browser:</strong> <br>GitHub <br>(collaborating with the outside world)</p>
</section>
<section>
<h2>Git Basics</h2>
<p>Commands we’re going to learn:</p>
<ol class="columns columns-count-2">
<li><a href="#/git-init">Init</a></li>
<li><a href="#/git-add">Add</a></li>
<li><a href="#/git-status">Status</a></li>
<li><a href="#/git-commit">Commit</a></li>
<li><a href="#/git-reset">Reset</a></li>
<li><a href="#/git-log">Log</a></li>
<li><a href="#/git-branch">Branch</a></li>
<li><a href="#/git-checkout">Checkout</a></li>
<li><a href="#/git-merge">Merge</a></li>
</ol>
<p><small>Note: the following examples show both the GUI and CLI versions for reference, but don’t mix them when you’re working or you’ll end up with weird errors.</small></p>
</section>
<section>
<p>Please follow along on your own computer, and ask questions if you’re stuck!</p>
</section>
<section>
<section id="git-init">
<!-- typo to fix! -->
<h3>Start Your Project (<code>init</code>)</h3>
<p><small>GUI</small></p>
<img src="images/git-init.png" alt="Creating a repo in GitHub for Mac" class="plain">
</section>
<section id="git-init">
<h3>Git Basics: <code>init</code></h3>
<p><small>CLI</small></p>
<pre><code>hello-world$ <span>git init</span></code></pre>
</section>
</section>
<section>
<section id="git-add">
<h3>Tell Git About Changes (<code>add</code>)</h3>
<p><small>Create a <code>README.md</code> and save to your project directory</small></p>
<p>We call this <strong>staging</strong> files.</p>
<p><small>GUI—Check the box next to files with changes you want to commit.</small></p>
<img src="images/git-add.png" alt="Adding files in GitHub for Mac" class="plain">
</section>
<section id="git-add">
<h3>Git Basics: <code>add</code></h3>
<p><small>CLI</small></p>
<pre><code>hello-world$ <span>git add README.md</span></code></pre>
</section>
</section>
<section>
<section id="git-status">
<h3>What’s Going on Right Now? (<code>status</code>)</h3>
<p><small>GUI—you don’t have to do anything but look</small></p>
<img src="images/git-status.png" alt="Checking status in GitHub for Mac" class="plain">
</section>
<section>
<h3>Git Basics: <code>status</code></h3>
<p><small>CLI</small></p>
<pre><code>hello-world$ <span>git status</span>
On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: README.md
hello-world$
</code></pre>
</section>
</section>
<section>
<section id="git-commit">
<h3>Tell Git to Save Your Changes (<code>commit</code>)</h3>
<p><small>GUI—type a summary and hit <code>Commit</code></small></p>
<img src="images/git-commit.png" alt="Committing in GitHub for Mac" class="plain">
</section>
<section>
<h3>Git Basics: <code>commit</code></h3>
<p>The <code>status</code> after commit</p>
<!-- typo to fix! -->
<p><small>BUI</small></p>
<img src="images/git-commit-status.png" alt="Committing in GitHub for Mac" class="plain">
</section>
<section>
<h3>Git Basics: <code>commit</code></h3>
<p><small>CLI</small></p>
<pre><code>hello-world$ <span>git commit -m "Adding README.md"</span></code></pre>
</section>
<section>
<h3>Git Basics: <code>commit</code></h3>
<p>The <code>status</code> after commit</p>
<p><small>CLI</small></p>
<pre><code>hello-world$ <span>git status</span>
On branch master
nothing to commit, working directory clean
hello-world$
</code></pre>
</section>
</section>
<section>
<section id="git-reset">
<h3>How Do I Commit Only Some Files?</h3>
<p><small>GUI—uncheck what you don’t want before you commit</small></p>
<img src="images/git-reset.png" alt="Unstaging a file in GitHub for Mac" class="plain">
</section>
<section>
<h3>Git Basics: <code>reset</code></h3>
<p>The <code>status</code> after committing—README.md still contains changes, but hasn't been committed.</p>
<p><small>GUI</small></p>
<img src="images/git-reset-status.png" alt="Resetting in GitHub for Mac" class="plain">
</section>
<section>
<h3>Git Basics: <code>reset</code></h3>
<p>In the CLI, <code>add</code> only the files you want to commit. If you add a file you don’t want to commit, use <code>reset</code> to <strong>unstage</strong> the file.</p>
<p><small>CLI</small></p>
<pre><code>hello-world$ <span>git add README.md</span>
hello-world$ <span>git add my-image.png</span>
hello-world$ <span>git reset HEAD README.md</span>
Unstaged changes after reset:
M README.md
hello-world$
</code></pre>
</section>
<section>
<h3>Git Basics: <code>reset</code></h3>
<p>The <code>status</code> after reset. Note that <code>status</code> provides helpful reminders for how to add or remove files from the staging area.</p>
<p><small>CLI</small></p>
<pre><code>hello-world$ <span>git status</span>
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: my-image.png
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: README.md
hello-world$
</code></pre>
</section>
</section>
<section>
<section id="git-log">
<!-- typo to fix! -->
<h3>Show Me What I’ve Done (<code>log</code>)</h3>
<p><small>GUI</small></p>
<img src="images/git-log.png" alt="Checking log in GitHub for Mac" class="plain">
</section>
<section>
<h3>Git Basics: <code>log</code></h3>
<p><small>CLI</small></p>
<pre><code>hello-world$ <span>git log</span>
commit e52416ead5588a1a8e8304d4523729a4dd3a9cf3
Author: Rachael Arnold <rae.arnold@gmail.com>
Date: Mon Feb 16 22:32:05 2015 -0500
Update README.md
commit 5dd358670179622c7640182439837d67883f8882
Author: Rachael Arnold <rae.arnold@gmail.com>
Date: Mon Feb 16 22:27:44 2015 -0500
Add my-image.png
commit 24d8c59bc4a6c817721412762c29e2454626d1d1
Author: Rachael Arnold <rae.arnold@gmail.com>
Date: Mon Feb 16 21:54:14 2015 -0500
Adding README.md
:<span>q</span>
</code></pre>
</section>
</section>
<!--
<section>
<h3>Git Basics: <code>commit</code> hashes</h3>
<p>As we saw in the log, each commit has a <strong>hash</strong></p>
<p><code>e52416ead5588a1a8e8304d4523729a4dd3a9cf3</code></p>
<p><code>e52416e</code></p>
<p>This is a unique identifier for your commit.</p>
</section>
-->
<section id="git-branch">
<h3>Git Basics: Branching</h3>
<p>Branches make it simple to work on experiments, major content changes, or bug fixes without danger of messing up existing work. You can continue to commit, but it won't change your main code base.</p>
<img src="images/branching.png" alt="Branching in GitHub for Mac" class="plain">
</section>
<section>
<section>
<h3>How Do I Experiment? (<code>branch</code>)</h3>
<p><small>GUI</small></p>
<img src="images/git-branch-1.png" alt="Branching in GitHub for Mac" class="plain">
<img src="images/git-branch-2.png" alt="Branching log in GitHub for Mac" class="plain">
</section>
<section>
<h3>Git Basics: <code>branch</code></h3>
<p><small>CLI</small></p>
<pre><code>hello-world$ <span>git branch my-experiment</span></code></pre>
</section>
</section>
<section>
<section id="git-checkout">
<h3>How Do I Switch Branches? (<code>checkout</code>)</h3>
<p><small>GUI</small></p>
<img src="images/git-checkout.png" alt="Checking out branches in GitHub for Mac" class="plain">
</section>
<section>
<h3>Git Basics: <code>checkout</code></h3>
<p><small>CLI</small></p>
<pre><code>hello-world$ <span>git checkout master</span></code></pre>
</section>
</section>
<section id="git-merge">
<h3>Git Basics: Merging</h3>
<p>Branches aren't much help if they live off on their own forever. Merging allows you to integrate changes from one branch into another.</p>
<img src="images/merging.png" alt="Merging in GitHub for Mac" class="plain">
</section>
<section>
<section>
<h3>How Do I Incorporate Changes? (<code>merge</code>)</h3>
<p><small>GUI</small></p>
<img src="images/git-merge-1.png" alt="Merging in GitHub for Mac" class="plain">
<img src="images/git-merge-2.png" alt="Merging log in GitHub for Mac" class="plain">
</section>
<section>
<h3>Git Basics: <code>merge</code></h3>
<p><small>CLI</small></p>
<pre><code>hello-world$ <span>git checkout master</span>
hello-world$ <span>git merge my-experiment</span></code></pre>
</section>
</section>
<section>
<section>
<h3>Oh no, conflicts!</h3>
<p><small>GUI</small></p>
<img src="images/git-merge-conflicts.png" alt="Merge conflicts in GitHub for Mac" class="plain">
</section>
<section>
<!-- typo to fix! -->
<h3>Git Bass: <code>merge</code> conflicts</h3>
<p><small>CLI</small></p>
<pre><code>hello-world$ <span>git status</span>
On branch master
You have unmerged paths.
(fix conflicts and run "git commit")
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: README.md
no changes added to commit (use "git add" and/or "git commit -a")
hello-world$</code></pre>
</section>
</section>
<section>
<section>
<h3>Resolving Conflicts</h3>
<p>To resolve conflicts, edit them in your normal file editor. Make sure to remove all <strong>merge flags</strong></p>
<img src="images/git-merge-conflicts-file.png" alt="Merge conflicts in GitHub for Mac" class="plain">
</section>
<section>
<h3>Resolving Conflicts</h3>
<img src="images/git-merge-conflicts-resolved.png" alt="Merge conflicts in GitHub for Mac" class="plain">
</section>
</section>
<section>
<section>
<h3>Finalizing the Merge</h3>
<p>Once you've resolved all the conflicts, <code>commit</code> the changes</p>
<p><small>GUI</small></p>
<img src="images/git-merge-fixed.png" alt="Merge conflicts in GitHub for Mac" class="plain">
</section>
<section>
<!-- typo to fix! -->
<h3>Finalizing thrge</h3>
<p><small>CLI</small></p>
<pre><code>hello-world$ <span>git commit -a -m "Merge branch 'my-experiment'"</code></pre>
<p>The <code>-a</code> is a shortcut for <code>git add</code> all the files with changes.</p>
</section>
</section>
<section>
<h2>Collaborating</h2>
<h3>…where GitHub comes in</h3>
</section>
<section>
<h3>GitHub Basics</h3>
<ol>
<li><a href="#/github-remotes">Setting Up Remotes</a><br>
<small>Publishing your repository, and syncing changes</small></li>
<li><a href="#/github-forking">Forking Projects</a><br>
<small>Making a copy of open-source projects for your own use</small></li>
<li><a href="#/github-pull-requests">Creating Pull Requests</a><br>
<small>Submitting changes to other people’s repos</small></li>
</ol>
</section>
<section>
<section id="github-remotes">
<h3>Publishing Remotely (<code>push</code>)</h3>
<p>Share your code with others by publishing to a remote (in this case, GitHub)</p>
<p><small>GUI</small></p>
<img src="images/github-publish.png" alt="Publishing to a remote in GitHub for Mac" class="plain">
</section>
<section>
<h3>Git Basics: <code>remote</code>, <code>push</code></h3>
<p><small>CLI</small></p>
<pre><code>hello-world$ <span>git remote add origin git@github.com:username/hello-world</span></code></pre>
<pre><code>hello-world$ <span>git push origin master</span></code></pre>
</section>
</section>
<section>
<h3>Publishing Remotely</h3>
<p>Check it out in the browser on GitHub</p>
<img src="images/github-published.png" alt="Publishing to a remote in GitHub for Mac" class="plain">
</section>
<section>
<h3>Publishing Remotely</h3>
<p>You can even edit some files online</p>
<img src="images/github-editing.png" alt="Publishing to a remote in GitHub for Mac" class="plain">
</section>
<section>
<section>
<h3>Getting Remote Changes (<code>pull</code>)</h3>
<p>When other changes are made (by you online, or by others who've pushed), you need to <code>pull</code> your changes.</p>
<!-- typo to fix! -->
<p><small>GUI—GitHub Desktop. makes it easy by changing Publish to <strong>Sync</strong></small></p>
<img src="images/github-sync.png" alt="Syncing from a remote in GitHub for Mac" class="plain">
</section>
<section>
<h3>Git Basics: <code>pull</code></h3>
<p><small>CLI</small></p>
<pre><code>hello-world$ <span>git pull</span>
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From https://github.com/raearnold/hello-world
88c0549..0ede7f1 master -> origin/master
Updating 88c0549..0ede7f1
Fast-forward
README.md | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
hello-world$</code></pre>
</section>
</section>
<section>
<section id="github-forking">
<h3>Forking Projects</h3>
<p>Copy projects and work on them in your own repo</p>
<p><small>Browser</small></p>
<img src="images/github-forking.png" alt="Forking in GitHub for Mac" class="plain">
</section>
<section>
<h3>Git Basics: <code>clone</code></h3>
<!-- typo to fix! -->
<p>Once you’ve fed a project, <code>clone</code> it locally</p>
<p><small>GUI</small></p>
<img src="images/git-clone.png" alt="Cloning in GitHub for Mac" class="plain">
</section>
<section>
<h3>Git Basics: <code>clone</code></h3>
<p><code>fork</code> is unique to GitHub; it’s all about permissions, as you can't contribute directly to repos that you haven't been granted access to. So, <code>fork</code> in the browser.</p>
<p>Then <code>clone</code> the forked repository to your local machine.</p>
<p><small>CLI</small></p>
<pre><code>hello-world$ <span>git clone https://github.com/raearnold/reveal.js.git</span></code></pre>
</section>
</section>
<section>
<section id="github-pull-requests">
<h3>Submitting Changes to Other Projects</h3>
<p>Once you've commited changes, you can ask the owners of the repositories to include your changes via a <strong>pull request</strong>.</p>
<p><small>GUI</small></p>
<img src="images/github-pull-request.png" alt="Pull requests in GitHub for Mac" class="plain">
</section>
<section>
<h3>Pull Requests</h3>
<p>Managing requests is beyond the basics, but this is what the request looks like in-browser.</p>
<!-- typo to fix! -->
<p><small>Mario</small></p>
<img src="images/github-pull-req-browser.png" alt="Pull Requests in GitHub for Mac" class="plain">
</section>
</section>
<section>
<h2>Lab Time</h2>
<ul>
<!-- typo to fix! -->
<li>Fix one typo in this presentation and submit a pull request. You can do this through the browser if you prefer.</li>
<li>Find something interesting, fork it, check out your fork locally.</li>
</ul>
<p>and</p>
<h2>Questions?</h2>
</section>
</div>
</div>
<script src="reveal/lib/js/head.min.js"></script>
<script src="reveal/js/reveal.js"></script>
<script>
// Full list of configuration options available at:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
transition: 'slide', // none/fade/slide/convex/concave/zoom
// Optional reveal.js plugins
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true },
{ src: 'plugin/notes/notes.js', async: true }
]
});
</script>
</body>
</html>