forked from ajmers/gdi-git-intro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
552 lines (508 loc) · 22.2 KB
/
index.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
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>girldevelopit-reveal.js - The GDI HTML Presentation Framework</title>
<meta name="description" content="Girl Develop It framework for easily creating beautiful presentations using HTML in GDI theme. Forked from Hakim El Hattab's reveal.js">
<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="css/reveal.css">
<link rel="stylesheet" href="css/theme/simple.css" id="theme">
<!-- For syntax highlighting -->
<!-- light editor<link rel="stylesheet" href="lib/css/light.css">-->
<!-- dark editor--><link rel="stylesheet" href="lib/css/dark.css">
<link rel="stylesheet" href="lib/css/zenburn.css">
<link rel="stylesheet" href="plugin/accessibility-helper/css/accessibility-helper.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 use the PDF print sheet so students can print slides-->
<link rel="stylesheet" href="css/print/pdf.css" type="text/css" media="print">
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<!--[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 -->
<!-- Installation and Setup-->
<section>
<h3>Installation and Setup</h3>
<h4>Install git</h4>
<a href = "http://git-scm.com/downloads" alt ="Download latest version of Git" target ="_blank">
<p>http://git-scm.com/downloads</p>
<img src = "images/install-git.png" alt = "Download latest version of Git"/>
</a>
<p>*Note for Windows Users: use Git Bash instead of Terminal</p>
</section>
<section>
<h3>Installation and Setup</h3>
<h4>Create a GitHub account</h4>
<p>Select a free account - your content will be public.</p>
<a href = "https://github.com/join" alt ="Signup for a free GitHub account" target ="_blank">
<p>https://github.com/join</p>
<img src = "images/github-signup.png" alt = "Signup for a free GitHub account"/>
</a>
</section>
<!-- Welcome-->
<section>
<h3>Welcome!</h3>
<div class = "left-align">
<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>What we will cover today</h3>
<ul>
<li class ="fragment">What is version control and why should we care?</li>
<li class ="fragment">Basics of git -- the essential commands</li>
<li class ="fragment">"Gitting" social with Github</li>
</ul>
</section>
<!-- Version control-->
<section>
<h3>What is version control?</h3>
<p>Version control allows you (and your team) to do two powerful things</p>
<div class="fragment">
<h4>Collaborate</h4>
<p>Create anything with other people, from academic papers to entire websites and applications.</p>
</div>
<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>
</section>
<section>
<h3>Working without Version Control</h3>
<img src = "images/no-vc.png" alt = "Trying to make a grocery list with 5 people and no version control"/>
<p>The Horror!</p>
</section>
<section>
<h3>Working with Version Control</h3>
<img src = "images/with-vc.png" alt = "Successfully making a grocery list with 5 people and version control"/>
<p>Rainbows and bunny rabbits!</h3>
</section>
<section>
<h3>Brief history of Version Control</h3>
<p class = "fragment"><span class ="green">1990s</span> -- CVS (Concurrent Version Systems)</p>
<p class = "fragment"><span class ="green">2000s</span> -- SVN (Apache Subversion)</p>
<p class = "fragment"><span class ="green">2005</span> -- Git (well, Git)</p>
</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>
<!-- Git-->
<section>
<h3>Intro to Git</h3>
<h4>Goals of Git Design</h4>
<ul>
<li class = "fragment">Fast -- add to your team and code base quickly</li>
<li class = "fragment">Distributed (see slide above) </li>
<li class = "fragment">Each commit has a corresponding hash (track changes from everyone)</li>
<li class = "fragment">Everyone has a local copy of the history</li>
</ul>
</section>
<section>
<h3>Git vs Github</h3>
<p>Git is not the same as Github</p>
<img src="images/git-vs-github.png" alt="Git and Github logos">
</section>
<!-- GitHub-->
<section>
<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>
<!-- New repository-->
<section>
<h3>GitHub</h3>
<h4>Create your first repository</h4>
<img src = "images/bootcamp_2_newrepo.jpg" alt ="How to create a new repository. Image from https://help.github.com/articles/create-a-repo"/>
</section>
<section>
<h3>GitHub</h3>
<h4>Create your first repository</h4>
<img src = "images/bootcamp_2_repoinfo.png" alt ="How to create a new repository. Image from https://help.github.com/articles/create-a-repo"/>
</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.
</blockquote>
</section>
<section>
<h3>Cloning</h3>
<h4>Create a Local Copy of Repo</h4>
<pre><code contenteditable class ="command-line">
cd ~/
git clone https://github.com/username/FORKED-REPO-NAME.git
cd FORKED-REPO-NAME
git remote add origin https://github.com/original-username/FORKED-REPO-NAME.git
# Assigns the original repository to a remote called "origin"
git remote -v
# Lists URL of remote repos
</code></pre>
</section>
<section>
<h3>Git Local Setup</h3>
<p>Setup name and email in gitconfig</p>
<pre><code contenteditable class ="command-line">
$ git config --global user.name "Your Name Here"
# Sets the default name for git to use when you commit
</code></pre>
<pre><code contenteditable class ="command-line">
$ git config --global user.email "[email protected]"
# Sets the default email for git to use when you commit
</code></pre>
<pre><code contenteditable class ="command-line">
$ git config --list
</code></pre>
</section>
<!-- First commands-->
<section>
<h3>Your first Local Repository</h3>
<p>Go to home directory</p>
<pre><code contenteditable class ="command-line">
cd ~/
OR
cd Users\username
</code></pre>
<p>Create a "working directory"</p>
<pre><code contenteditable class ="command-line">
mkdir my-first-repo
cd my-first-repo
</code></pre>
<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>Commit the change</p>
<pre><code contenteditable class ="command-line">
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 <[email protected]>
Date: [DATE HERE]
First commit. Added hello world to repository.
</code></pre>
</section>
<section>
<h3>Look at our progress, visually</h3>
<pre><code contenteditable class ="command-line">
gitk
</code></pre>
<img src = "images/gitk.png" alt ="Image of commits for this curriculum repo"/>
</section>
<section>
<h3>Problem?</h3>
<pre><code contenteditable class="command-line">
-bash: gitk: command not found
</code></pre>
<a href="http://git-scm.com/downloads/guis" alt="Git GUIs" target="_blank">http://git-scm.com/downloads/guis</a></br>
<pre><code contenteditable class="command-line">
-Error in startup script: unknown color name "lime"
</code></pre>
<a href="https://learningtowebdevblog.wordpress.com/2016/10/08/gitk-error-unknown-color-name-lime/" alt="Fix lime error" target="_blank">Replace "lime" with hex code #99FF00 in /usr/local/bin/gitk</a></br>
</section>
<section>
<h3>Other git GUIs</h3>
<a href="https://www.sourcetreeapp.com/" alt="Sourcetree" target="_blank">SourceTree (Mac, Windows)</a></br>
<a href="http://gitx.frim.nl/" alt="gitx" target="_blank">Gitx (Mac only)</a></br>
</section>
<!-- Undoing changes -->
<section>
<h3>Nobody's Perfect</h3>
<h4>Undoing local changes</h4>
<p>If you haven't committed yet</p>
<div>
<p>Open hello_world.txt and add some new text</p>
<pre><code contenteditable class ="command-line">
git checkout hello_world.txt
</code></pre>
</div>
<p>Look at hello_world.txt. Your changes are gone.</p>
</section>
<section>
<h3>Nobody's Perfect</h3>
<h4>Undoing staged changes</h4>
<div>
<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>Look at hello_world.txt. Your changes are gone.</p>
</section>
<section>
<h3>Nobody's Perfect</h3>
<h4>Undoing committed changes</h4>
<div>
<p>Open hello_world.txt and add some new text</p>
<pre><code contenteditable class ="command-line">
git add hello_world.txt
git commit -am "Changing and committing some lines"
git log --pretty=oneline
git revert [HASH]
</code></pre>
</div>
<p>Look at hello_world.txt. Your changes are gone.</p>
</section>
<!-- Branches-->
<section>
<h3>Branching</h3>
<ul>
<li class ="fragment">Develop different code on the same base</li>
<li class ="fragment">Conduct exploratory work without affecting the work on master branch</li>
<li class ="fragment">Incorporate changes to your master branch only when you are ready</li>
</ul>
</section>
<section>
<h3>Branching</h3>
<img src = "images/branch-workflow.png" alt = "Workflow of branchs in GitHub - Image from http://3.bp.blogspot.com/_KJLBBSxY7xs/TMnp7AQUQAI/AAAAAAAAAOc/VtcBxp0FTXs/s378/bm002.png" />
</section>
<section>
<h3>Branching</h3>
<p>Create a new branch called version2</p>
<pre><code contenteditable class ="command-line">
git checkout -b version2
</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 to version 2"
</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 version2 and look at hello_world.txt</p>
<pre><code contenteditable class ="command-line">
git checkout version2
</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 version2
</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 in master"
</code></pre>
<p>Change first line in hello_world.txt in version2 branch</p>
<pre><code contenteditable class ="command-line">
git checkout version2
# open hello_world.txt and change first line
git add hello_world.txt
git commit -m "Changing first line in version2"
</code></pre>
</section>
<section>
<h3>Merging</h3>
<h4>Merge conflicts, cont.</h4>
<p>Merge from master into version2</p>
<pre><code contenteditable class ="command-line">
git merge master
</code></pre>
<p>You will be notified of a conflict. Go to the file and fix the problem. Then commit your edits.</p>
</section>
<section>
<h3>GitHub</h3>
<h4>Push to GitHub Repo</h4>
<pre><code contenteditable class ="command-line">
git push origin master
</code></pre>
<p>Go look at your github repo online</p>
</section>
<section>
<h3>GitHub</h3>
<h4>Pulling from remote repository</h4>
<p>If you are working with a team, you want to make sure that you have everyone's changes before pushing your changes to the GitHub repo</p>
<img src = "images/push-pull.png" alt="Pulling from remote and pushing local changes on GitHub - Image from GitHub" />
</section>
<section>
<h3>GitHub</h3>
<h4>Pulling and Pushing</h4>
<pre><code contenteditable class ="command-line">
# Commit local changes
git commit -m "My latest commit"
# Pull changes other people have made
git pull origin master
# Fix any conflicts (see merge conflicts above) and commit
git commit -m "Fixing merging conflicts"
# push local changes to GitHub
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>Forking</h3>
<p>Fork This Repo</p>
<a href="https://github.com/ajmers/gdi-git-intro" title="Fork This Repo - gdi-git-intro">https://github.com/ajmers/gdi-git-intro</a>
<img src = "images/bootcamp_3_fork.jpg" alt ="How to fork a repository. Image from https://help.github.com/articles/fork-a-repo"/>
</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>Starting a pull request</h3>
<img src = "images/click-pull-request.png" alt ="How to initiate a pull request. Image from https://help.github.com/articles/using-pull-requests"/>
</section>
<section>
<h3>Previewing and sending pull request</h3>
<img src = "images/pull-request.png" alt ="How to preview and send a pull request. Image from https://help.github.com/articles/using-pull-requests"/>
</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>
<h2>Survey</h2>
<p>
<a href='http://bit.ly/2e4dTxP'>Please take a moment to give us your feedback.</a>
<span> http://bit.ly/2e4dTxP </span>
</p>
</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="lib/js/head.min.js"></script>
<script src="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,
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 },
{ src: 'plugin/accessibility-helper/js/accessibility-helper.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
</script>
</body>
</html>