forked from girldevelopit/gdi-featured-git-github
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
545 lines (519 loc) · 22.2 KB
/
index.html
File metadata and controls
545 lines (519 loc) · 22.2 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Intro to Git and Github ~ Girl Develop It</title>
<meta name="description" content="This is the official Girl Develop It Core Intro to Git and GitHub course. Material based on original material by Kim Moir, Daniel Fischer, Aurelia Moser, Carina C. Zona and Izzy Johnston.
The course is meant to be taught in a two-hour workshop. Each of the slides and practice files are customizable according to the needs of a given class or audience.">
<meta name="author" content="Girl Develop It">
<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="reveal/css/reveal.css">
<link rel="stylesheet" href="reveal/css/theme/gdilight.css" id="theme">
<!-- For syntax highlighting -->
<!-- light editor--><link rel="stylesheet" href="lib/css/light.css">
<!-- dark editor><link rel="stylesheet" href="reveal/lib/css/dark.css"-->
<!-- If use the PDF print sheet so students can print slides-->
<link rel="stylesheet" href="reveal/css/print/pdf.css" type="text/css" media="print">
<!--[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">
<!-- Opening slide -->
<section>
<img src = "images/gdi_logo_badge.png">
<h3>Intro to Git and Github</h3>
</section>
<!-- Welcome-->
<section>
<h3>Welcome!</h3>
<div class = "left-align">
<p>Girl Develop It is here to provide affordable and accessible programs to learn software through mentorship and hands-on instruction.</p>
<p class ="green">Some "rules"</p>
<ul>
<li>We are here for you!</li>
<li>Every question is important</li>
<li>Help each other</li>
<li>Have fun</li>
</ul>
</div>
</section>
<section>
<h3>Welcome!</h3>
<div class = "left-align">
<p class = "blue">Tell us about yourself.</p>
<ul>
<li>Who are you?</li>
<li>What do you hope to get out of the class?</li>
<li>Who was your favorite character as a child?</li>
</ul>
</div>
</section>
<section>
<h3>What we will cover today</h3>
<div class="fragment">What is version control and why should we care?</div>
<br>
<div class="fragment">Basics of Git and the essential commands</div>
<br>
<div class="fragment">Using Git with GitHub to collaborate</div>
</section>
<!-- Version control-->
<section>
<h3>What is version control?</h3>
<p>Version control allows you (and your team) to do two powerful things</p>
<br>
<div class="fragment">
<h4>Track and revert changes</h4>
<p>Mistakes happen. Wouldn't it be nice if you could see the changes that have been made and go "back in time" to fix something that went wrong?
</div>
<div class="fragment">
<h4>Collaborate</h4>
<p>Create anything with other people, from academic papers to entire websites and applications.</p>
</div>
</section>
<section>
<h3>Version Control Types</h3>
<div class="fragment">
<h4>Centralized Version Control</h4>
<p>Examples: CVS, SVN</p>
<p>One central server, each client (person) checks out and merges changes to main server</p>
</div>
<div class="fragment">
<h4>Distributed Version Control</h4>
<p>Examples: Git, Mercurial</p>
<p>Each client (person) has a local repository, which they can then reconcile with the main server.</p>
</div>
</section>
<section>
<h3>Version Control Types</h3>
<h4>Centralized vs Distributed</h4>
<img src="images/git-vs-svn.png" alt ="Git vs SVN"/></a>
</section>
<section>
<h3>Example Workflows</h3>
<h4>Non linear</h4>
<img src="images/git-workflow-logo.png" alt ="Non linear workflow"/></a>
</section>
<section>
<h3>Example Workflows</h3>
<h4>Subversion-style (centralized)</h4>
<img src="images/svn-style.png" alt ="Subversion-style (centralized) workflow"/></a>
</section>
<section>
<h3>Example Workflows</h3>
<h4>Integration Manager</h4>
<img src="images/integration-manager.png" alt ="Integration manager"/></a>
</section>
<section>
<h3>Example Workflows</h3>
<h4>Dictator and Lieutenants</h4>
<img src="images/dictator-lieutenants.png" alt ="Dictator and Lieutenants"/></a>
</section>
<section>
<h3>Version Control Distribution</h3>
<h4>Stack Overflow Developer Survey 2016</h4>
<a href = "https://stackoverflow.com/research/developer-survey-2015" target="_blank" alt ="Stack Overflow Developer Survey 2015"><img src = "images/stack-overflow-graph.png" alt ="Version control usage from the Stack Overflow Developer Survey 2015"/></a>
</section>
<!-- Git-->
<section>
<h3>Intro to Git</h3>
<p>Goals of Git Design</p>
<ul>
<li>Fast - Add to your team and code base quickly</li>
<li>Non-linear - Support for multiple users and sets of changes</li>
<li>Reliable - Safeguards protect code from corruption</li>
<li>Distributed - Everyone has a local copy of the history</li>
</ul>
</section>
<section>
<h3>Without Version Control</h3>
<img src = "images/many-files-example.png" alt ="Version control share between Bazaar, CVS, Git, Mercurial and Subversion"/></a>
</section>
<section>
<h3>With Version Control</h3>
<img src = "images/one-file-example.png" alt ="Version control distribution share between 2010 and 2012 between Bazaar, CVS, Git, Mercurial and Subversion"/></a>
<img src = "images/git-log-example.png" alt ="Version control distribution share between 2010 and 2012 between Bazaar, CVS, Git, Mercurial and Subversion"/></a>
</section>
<!-- Installation and Setup-->
<section>
<h3>Installation and Setup</h3>
<a href = "https://help.github.com/articles/set-up-git/" alt ="Set up Git" target ="_blank">
<br>
<p>Git installation instructions on GitHub</p>
<img src = "images/git-logo.png" alt = "Git logo"/>
</a>
</section>
<!-- First commands-->
<section>
<h3>Your first Local Repository</h3>
<p>Go to home directory</p>
<p>In the bash terminal:
<pre><code contenteditable class ="command-line">
cd ~
</code></pre>
<p>Create a "working directory"</p>
<pre><code contenteditable class ="command-line">
mkdir my-first-repo
cd my-first-repo
</code></pre>
</section>
<section>
<p>Initialize repository with Git</p>
<pre><code contenteditable class ="command-line">
git init
git status
</code></pre>
</section>
<section>
<h3>Add files</h3>
<p>Create a new hello_world.txt file in your new folder</p>
<p>Check repo status</p>
<pre><code contenteditable class ="command-line">
git status
</code></pre>
<p>Tell Git to track our new file</p>
<pre><code contenteditable class ="command-line">
git add hello_world.txt
git status
</code></pre>
<p>File is now tracked by Git</p>
</section>
<section>
<h3>Changes and commits</h3>
<p>Open hello_world.txt and add some more text</p>
<pre><code contenteditable class ="command-line">
git status
</code></pre>
<p>Stage and commit the change</p>
<pre><code contenteditable class ="command-line">
git add hello_world.txt
git commit -m "First commit. Added hello world to repository."
</code></pre>
</section>
<!-- Explanation-->
<section>
<h3>What did we just do??</h3>
<p>How is this all different than just saving a file?</p>
<ul>
<li class="fragment">When we <span class ="green">add</span> a new file, we tell Git to add the file to the repository to be tracked</li>
<li class="fragment">When we <span class ="green">stage</span> an existing file (also with the keyword 'add'), we are telling Git to track the current state of our file</li>
<li class="fragment">A <span class ="green">commit</span> saves changes made to a file, not the file as a whole. The commit will have a 'hash' so we can track which changes were committed when and by whom.</li>
</ul>
</section>
<section>
<h3>Look at our progress</h3>
<pre><code contenteditable class ="command-line">
git log
</code></pre>
<pre><code contenteditable class ="command-line">
commit [HASH HERE]
Author: Your name <you@your-email.com>
Date: [DATE HERE]
First commit. Added hello world to repository.
</code></pre>
</section>
<!-- Undoing changes -->
<section>
<h3>Nobody's Perfect</h3>
<h4>Undoing local changes</h4>
<p>If you haven't committed yet</p>
<div class = "fragment">
<p>Open hello_world.txt and add some new text</p>
<pre><code contenteditable class ="command-line">
git status
git checkout hello_world.txt
git status
</code></pre>
</div>
<p class="fragment">Look at hello_world.txt. Your changes are gone.</p>
</section>
<section>
<h3>Nobody's Perfect</h3>
<h4>Undoing staged changes</h4>
<div class = "fragment">
<p>Open hello_world.txt and add some new text</p>
<pre><code contenteditable class ="command-line">
git add hello_world.txt
git reset HEAD hello_world.txt
git checkout hello_world.txt
</code></pre>
</div>
<p class="fragment">Look at hello_world.txt. Your changes are gone.</p>
</section>
<section>
<h3>Nobody's Perfect</h3>
<h4>Undoing committed changes</h4>
<div class = "fragment">
<p>Open hello_world.txt and add some new text</p>
<pre><code contenteditable class ="command-line">
git add hello_world.txt
git commit -m "Changing and committing some lines"
git log --pretty=oneline
git revert [HASH]
</code></pre>
</div>
<p class="fragment">Look at hello_world.txt. Your changes are gone.</p>
</section>
<section>
<h3>Nobody's Perfect</h3>
<h4>Remove a file from staging</h4>
<p>Create new file my_new_file.txt</p>
<pre><code contenteditable class ="command-line">
git add my_new_file.txt
git reset my_new_file.txt
</code></pre>
</section>
<section>
<h3>Nobody's Perfect</h3>
<h4>Delete a file</h4>
<p>Create new file my_other_file.txt</p>
<pre><code contenteditable class ="command-line">
git add my_other_file.txt
git commit -m "Add new file"
</code></pre>
<p>Manually delete your file</p>
<pre><code contenteditable class ="command-line">
git rm my_other_file.txt
git commit -m "Remove file"
</code></pre>
</section>
<!-- Branches-->
<section>
<h3>Branching</h3>
<ul>
<li>Develop different code on the same base</li>
<li>Conduct exploratory work without affecting the work on master branch</li>
<li>Incorporate changes to your master branch only when you are ready</li>
</ul>
</section>
<section>
<h3>Git Branching</h3>
<img src = "images/wunderflow.png" alt ="Wunderflow chart"/></a>
</section>
<section>
<h3>Branching</h3>
<p>Create a new branch called new-feature</p>
<pre><code contenteditable class ="command-line">
git checkout -b new-feature
</code></pre>
<p>Add new lines to hello_world.txt</p>
<pre><code contenteditable class ="command-line">
git add hello_world.txt
git commit -m "Adding changes for new feature"
</code></pre>
</section>
<section>
<h3>Branching</h3>
<h4>Switching branches</h4>
<p>See all branches. Branch with * is active</p>
<pre><code contenteditable class ="command-line">
git branch
</code></pre>
<p>Switch to master and look at hello_world.txt</p>
<pre><code contenteditable class ="command-line">
git checkout master
</code></pre>
<p>Switch to new-feature and look at hello_world.txt</p>
<pre><code contenteditable class ="command-line">
git checkout new-feature
</code></pre>
</section>
<!-- Merging-->
<section>
<h3>Merging</h3>
<h4>Merge to get changes from one branch into another*</h4>
<p>Switch to master and merge changes</p>
<pre><code contenteditable class ="command-line">
git checkout master
git merge new-feature
</code></pre>
<p>Rebase is another option, but will not be covered in this workshop</p>
</section>
<section>
<h3>Merging</h3>
<h4>Merge conflicts</h4>
<p>Change first line in hello_world.txt in master branch</p>
<pre><code contenteditable class ="command-line">
git add hello_world.txt
git commit -m "Changing first line on master"
</code></pre>
<p>Switch to new-feature branch</p>
<pre><code contenteditable class ="command-line">
git checkout new-feature
</code></pre>
<p>Open hello_world.txt and change first line</p>
<pre><code contenteditable class ="command-line">
git add hello_world.txt
git commit -m "Changing first line on new-feature"
</code></pre>
</section>
<section>
<h3>Merging</h3>
<h4>Merge conflicts, cont.</h4>
<p>Merge from master into new-feature</p>
<pre><code contenteditable class ="command-line">
git merge master
</code></pre>
<p class ="fragment">You will be notified of a conflict. Go to the file and fix the problem. Then commit your edits.</p>
</section>
<!-- GitHub-->
<section>
<h3><a href = "http://www.github.com" alt="GitHub homepage">GitHub</a></h3>
<ul>
<li class ="fragment">Launched in <span class ="green">2008</span></li>
<li class = "fragment">Leader in <span class ="green">Social Coding</span></li>
<li class = "fragment">GitHub is a commercial site that allows users to <span class = "green">host Git repositories</span> publicly and privately</li>
<li class ="fragment"><span class ="green">Open source projects</span> host or mirror their repositories on GitHub</li>
<li class ="fragment"><span class ="green">Post your own code</span> for others to use or contribute to</li>
<li class ="fragment">Use and <span class ="green">learn</span> from the code in other people's repositories</li>
</ul>
</section>
<section>
<h3>GitHub</h3>
<img src = "images/svn-style.png" alt ="GitHub as a central server"/></a>
</section>
<section>
<h3>Git repository servers</h3>
<ul>
<li><a href="https://github.com/">GitHub</a></li>
<li><a href="https://bitbucket.org/">Bitbucket</a></li>
<li><a href="https://about.gitlab.com/">GitLab</a></li>
<li>and more!</li>
</ul>
</section>
<!-- New repository-->
<section>
<h3>GitHub</h3>
<a href="https://help.github.com/articles/create-a-repo/">Create your first repository on GitHub</a>
</section>
<section>
<h3>GitHub</h3>
<h4>ReadME</h4>
<blockquote>
While a README isn't a required part of a GitHub repository, it is a very good idea to have one. READMEs are a great place to describe your project or add some documentation such as how to install or use your project. You might want to include contact information - if your project becomes popular people will want to help you out.
</blockquote>
</section>
<section>
<h3>GitHub</h3>
<h4>Get Local Repository of GitHub Repo</h4>
<pre><code contenteditable class ="command-line">
cd ..
mkdir hello-world
cd hello-world
git init
git remote add origin https://github.com/USERNAME/hello-world.git
git pull origin master
</code></pre>
</section>
<section>
<h3>GitHub</h3>
<h4>Push to GitHub Repo</h4>
<p>Edit the ReadMe file
<pre><code contenteditable class ="command-line">
git add README
git commit -m "Create readme file"
git push origin master
</code></pre>
<p class ="fragment">Go look at your github repo online</p>
</section>
<section>
<h3>GitHub</h3>
<h4>Pulling from remote repository</h4>
<p>If you're working with a team, make sure that you have everyone's changes before pushing your own changes.</p>
<ol>
<li>Commit local changes</li>
<li>Pull changes other people have made</li>
<li>Fix any conflicts and commit</li>
<li>Push local changes to GitHub</li>
</ol>
<pre><code contenteditable class ="command-line">
git commit -m "My latest commit"
git pull origin master
git commit -m "Fixing merging conflicts"
git push origin master
</code></pre>
</section>
<!-- Fork a repository-->
<section>
<h3>Forking</h3>
<ul>
<li>There are <span class = "green">MILLIONS</span> of public repositories on GitHub</li>
<li>If you want to <span class = "green">use</span> or <span class = "green">contribute</span> to a repository, you can fork it.</li>
</ul>
</section>
<section>
<h3>GitHub</h3>
<a href="https://help.github.com/articles/fork-a-repo/">Fork a repository on GitHub</a>
</section>
<!-- Pull requests-->
<section>
<h3>Pull Requests</h3>
<ul>
<li class = "fragment">After you fork and clone a repository all pushed changes will go to your fork</li>
<li class = "fragment">These changes will not affect the original repository</li>
<li class = "fragment">If you would like to get your changes to be incorporated into the original repo, you can submit a pull request</li>
</ul>
</section>
<section>
<h3>GitHub</h3>
<a href="https://help.github.com/articles/using-pull-requests/">Open a Pull Request on GitHub</a>
</section>
<section>
<h3>Managing pull requests</h3>
<p>How to manage pull requests is out of the scope of this short workshop, but you can learn more from the <a href = "https://help.github.com/categories/63/articles" target ="_blank" alt = "Links to tutorials on pull requests and collaboration">Github Collaborating Tutorials</a>
</section>
<!-- -->
<section>
<h2>Questions?</h2>
<div style = "font-size:1200%; height:100%; margin-top:40%" class ="blue">?
<div class ="clear"></div></div>
</section>
<section>
<h3>Resources</h3>
<p><a href="https://git-scm.com/book/en/v2/Getting-Started-Git-Basics">Git Basics</a></p>
<p><a href="https://try.github.io/">Try Git in the browser</a></p>
<p><a href="https://help.github.com/">GitHub Help</a></p>
<p><a href="https://services.github.com/kit/downloads/github-git-cheat-sheet.pdf">GitHub Cheat Sheet</a></p>
</section>
<section>
<h2>GDI Survey</h2>
<p>Please complete the GDI survey for this workshop.</p>
<p><a href="https://docs.google.com/forms/d/1PfT6t5r-2fnf2s_H4B7bq-751MHThYffnzCwD4EBdpQ/viewform?c=0&w=1">Click here!</a></p>
</section>
</section>
</div>
<footer>
<div class="copyright">
Intro to Git and Github ~ Girl Develop It ~
<a rel="license" href="http://creativecommons.org/licenses/by-nc/3.0/deed.en_US"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc/3.0/80x15.png" /></a>
</div>
</footer>
</div>
<script src="reveal/lib/js/head.min.js"></script>
<script src="reveal/js/reveal.min.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/zoom/linear/none
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'reveal/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'reveal/plugin/markdown/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'reveal/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'reveal/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'reveal/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'reveal/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
</script>
</body>
</html>