-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
630 lines (544 loc) · 24.9 KB
/
index.html
File metadata and controls
630 lines (544 loc) · 24.9 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
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Intro to Git Workshop ~ Girl Develop It</title>
<meta name="description" content="This is the Girl Develop It Intro to Git Workshop. 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 one-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="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 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">
<!--early bird slide-->
<section>
<h3>Hey Early Birds!</h3>
<a href="http://git-scm.com/downloads" alt="Download latest version of Git" target="_blank">
<p>Get a jump on the day and install git now!</p>
<p>http://git-scm.com/downloads</p>
<img src="img/install-git.png" alt="Download latest version of Git"/>
</a>
</section>
<!-- Opening slide -->
<section>
<img src="img/gdi_logo_badge.png" alt="">
<h3>Intro to Git Workshop</h3>
<p>Slides: <a href="https://girldevelopit.github.io/gdi-git-workshop">https://girldevelopit.github.io/gdi-git-workshop</a></p>
</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 fictional character as a child?</li>
</ul>
</div>
</section> -->
<section>
<h3>What We Will Cover Today</h3>
<ul>
<li class="fragment">What is version control?</li>
<li class="fragment">Basics of git – the essential commands</li>
<li class="fragment">"Gitting" social with Github</li>
</ul>
</section>
<section>
<h3>Real Talk</h3>
<p>Git isn't simple. Like most powerful tools, it's complex and takes some time to master.</p>
</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>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>Working Without Version Control</h3>
<img src="img/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="img/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><span class="green">1990s</span> -- CVS (Concurrent Version Systems)</p>
<p><span class="green">2000s</span> -- SVN (Apache Subversion)</p>
<p><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>
<p><small>More info about the differences <a href="https://blogs.atlassian.com/2012/02/version-control-centralized-dvcs/" alt="blog post about centralized vs distributed vc">here</a>.</small></p>
</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>Distributed (see slide above) - you can work without a network connection </li>
<li>Each commit has a unique identifier, a SHA (Secure Hash Algorithm, a.k.a hash)</li>
<li>Everyone has a local copy of the history</li>
</ul>
</section>
<!-- Installation and Setup-->
<section>
<h3>Installation And Setup</h3>
<img src="img/install-git.png" alt="Download latest version of Git"/>
<h4>On Mac</h4>
<p><a href="http://git-scm.com/downloads">Install Git http://git-scm.com/downloads</a></p>
<h4>On Windows</h4>
<p><a href="https://git-for-windows.github.io/">Install Git for Windows https://git-for-windows.github.io/</a></p>
<br>
<br>
</section>
<section>
<h3>Open The Terminal</h3>
<h4>On Mac</h4>
<p>Press CMD+SPACE<br>and search 'Terminal' and hit enter</p>
<h4>On Windows</h4>
<p>Press WinKey<br> and search 'mintty' and hit enter</p>
</section>
<section>
<h3>Installation And Setup</h3>
<p>Configure Git with your name and email</p>
<pre><code contenteditable class="command-line">
# I'm a comment! Don't enter me in command line.
# Do enter lines that start with a $, but don't type the $.
# Set the name git associates with your commits
$ git config --global user.name "Your Name Here"
# Set the email git associates with your commits
$ git config --global user.email "your_email@example.com"
# Show your configuration settings
$ git config --list
</code></pre>
</section>
<section>
<h3>Installation And Setup</h3>
<p>An SSH key is like a secret handshake between your computer and Github. It allows Github's servers to verify your identity via public-key cryptography and challenge-response authentication- not via you typing in your Github password. It's super secure and not too difficult to set up. </p>
<a href="https://wiki.archlinux.org/index.php/SSH_Keys" alt="article about ssh keys">More info about SSH keys</a>.
</section>
<section>
<h3>Installation And Setup</h3>
<p>Setup ssh keys following this guide:<br>
<a href="https://help.github.com/articles/generating-ssh-keys">https://help.github.com/articles/generating-ssh-keys</a></p>
</section>
<!-- First commands-->
<section>
<h3>Your First Local Repository</h3>
<pre><code contenteditable class="command-line">
# Change to your home directory
cd ~
# OR
cd
# Create and move to a "working directory"
mkdir my-repo
cd my-repo
# Initialize directory as a Git repository
git init
</code></pre>
</section>
<section>
<h3>Add Files</h3>
<p>Create a new <code>hello.txt</code> file in your <code>my-repo</code> directory, then check repo status</p>
<pre><code contenteditable class="command-line">
touch hello.txt
git status
</code></pre>
<p>Tell Git to track our new file</p>
<pre><code contenteditable class="command-line">
git add hello.txt
git status
</code></pre>
<p>File is now tracked by Git!</p>
</section>
<section>
<h3>Changes And Commits</h3>
<p>Open <code>hello.txt</code> and add some text, then check your git status</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.txt
git commit -m "Added first file 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 file, we tell Git to track the current state of it. This is also known as 'staging' the file.</li>
<li class="fragment">A <span class="green">commit</span> saves changes made to staged files, not the whole files. The commit allows us to 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
commit [SHA HERE]
Author: Your name <you@your-email.com>
Date: [DATE HERE]
Added first file to repository.
</code></pre>
<p>Cool! We'll be using that SHA later...</p>
</section>
<section>
<h3>Git Is Helpful</h3>
<p>Always read the output of running git commands. They may look a little intimidating, but they contain all sorts of useful information. When in doubt, run:</p>
<pre><code class="command-line">
git status
</code></pre>
</section>
<section>
<h3>Basic Git Worklow</h3>
<p>This is the general workflow in a Git repository</p>
<pre><code contenteditable class="command-line">
git init # Just once, to initialize
# Do some stuff to files
git status # What's up, git?
git add [filename] # Stage changes to a file
git commit -m "" # Commit a set of changes
git status # What's up, git?
</code></pre>
</section>
<!-- Undoing changes -->
<section>
<h3>Undoing Changes</h3>
<h4>Undoing Local Changes</h4>
<div>
<p>If you've added some new text to <code>hello.txt</code>, but not yet staged it, just run:</p>
<pre><code contenteditable class="command-line">
git checkout hello.txt
</code></pre>
</div>
<p class="fragment"><code>hello.txt</code> is reset to its state at the last commit - your changes are gone!</p>
</section>
<section>
<h3>Undoing Changes</h3>
<h4>Un-stage a file</h4>
<p>If you already staged hello.txt, run:</p>
<pre><code contenteditable class="command-line">
git reset hello.txt
</code></pre>
<p><code>hello.txt</code> is no longer staged, you can make whatever changes you like to it, and re-stage when it's ready.</p>
</section>
<section>
<h3>Undoing Changes</h3>
<h4>Delete A Staged File</h4>
<p>If you've already staged <code>hello.txt</code>, but want to delete it instead, run:</p>
<pre><code contenteditable class="command-line">
git rm -f hello.txt
</code></pre>
<p>The file is deleted, and its deletion will be part of your commit.</p>
</section>
<section>
<h3>Undoing Changes</h3>
<h4>Undo staged changes</h4>
<p>If you've made some changes to <code>hello.txt</code> and staged it, but want the changes to disappear, run:</p>
<pre><code contenteditable class="command-line">
git reset hello.txt # Unstage
git checkout hello.txt # Undo all my local changes
</code></pre>
<p><code>hello.txt</code> is unstaged and reset to its state at the last commit - your changes are gone!</p>
</section>
<section>
<h3>Undoing Changes</h3>
<h4>Undoing committed changes: Part 1</h4>
<div>
<p>If you've made changes and committed them, you can revert all the changes that happened in a specific commit by running:</p>
<pre><code contenteditable class="command-line">
git log # Display log of commits
git revert [SHA] # Un-does specified commit with opposite changes
</code></pre>
<p>This doesn't have to be your most recent commit- you can revert any commit. It will just undo the entire set of changes that were included in that commit.</p>
</div>
</section>
<section>
<h3>Undoing Changes</h3>
<h4>Undoing Committed Changes: Part 2</h4>
<div>
<p>You can roll back your repo's state to where it was after any previous commit by running this with the SHA of the commit you'd like to reset to:</p>
<pre><code contenteditable class="command-line">
git log # Display log of commits
git reset --hard [SHA] # Reset the repo
</code></pre>
</div>
<p>This rolls back all changes since the specified commit - be careful! This isn't often used in real life.</p>
</section>
<!-- Branches-->
<section>
<h3>Branching</h3>
<div>
<p>Provide you with a separate space for you make changes.
It's part of how you collaborate with other people.
</p>
<ul>
<li>Focus on small changes</li>
<li>New features</li>
<li>Improve existing code </li>
<li>Hot Fixes — <strong>EMERGENCY!</strong></li>
</ul>
</div>
</section>
<section>
<h3>Merging</h3>
<div>
<p>Combine your current branch with another branch</p>
<ul>
<li>Part of how you collaborate with other people</li>
<li>There are different ways to merge</li>
</ul>
</div>
</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>
<!-- New repository-->
<section>
<h3>GitHub</h3>
<h4>Create Your First Repository</h4>
<img src="img/newrepogh.png" alt="How to create a new repository."/>
</section>
<section>
<h3>GitHub</h3>
<h4>Create Your First Repository</h4>
<img src="img/newrepodeets.png" alt="How to create a new repository."/>
</section>
<section>
<h3>GitHub</h3>
<h4>README</h4>
<p>
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.
</p>
</section>
<section>
<h3>GitHub</h3>
<h4>Setting Up Remote Connection</h4>
<p>Copy SSH link from Github repo</p>
<img src="img/clonelink.png" alt="link to clone repo" />
<pre><code contenteditable class="command-line">
# From inside your local git repo
git remote add origin [pasted link from Github]
# Pull first, when creating connection
git pull origin master
# Push your local work to the repo
git push origin master
</code></pre>
</section>
<!-- let's develop it-->
<section>
<h3>GitHub</h3>
<h4>Push to GitHub Repo</h4>
<p>As you make changes locally, push to Github.</p>
<p>Make a change to your README file, then add and commit it. Then, push!</p>
<pre><code contenteditable class="command-line">
git push origin master
</code></pre>
<p>Go check out your Github repo online to see your changes.</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>
<pre><code contenteditable class="command-line">
# Pull current state from Github
git pull origin master
# Fix any conflicts (see merge conflicts above) and commit
# then, 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>
<li>This will create a copy of it in your Github account</li>
</ul>
</section>
<section>
<h3>Forking</h3>
<p>Go to <a href="https://github.com/gdiseattle/GitResources" alt="Cheri's resources">https://github.com/gdiseattle/GitResources</a> and hit the fork button.</p>
<img src="img/bootcamp_3_fork.jpg" alt="How to fork a repository. Image from https://help.github.com/articles/fork-a-repo"/>
</section>
<section>
<h3>Forking</h3>
<h4>Cloning</h4>
<p>Go to <strong>your</strong> GitResources repo on Github, find this link and copy it.</p>
<img src="img/clonelink.png" alt="Link to clone repo"/>
</section>
<section>
<h3>Forking</h3>
<h4>Cloning</h4>
<p>Navigate to the location you want new directory to be in- NOT INSIDE ANOTHER GIT REPO! Then, clone to get a local repository of your fork.</p>
<pre><code contenteditable class="command-line">
git clone https://github.com/username/FORKED-REPO-NAME.git
cd FORKED-REPO-NAME
</code></pre>
</section>
<section>
<h3>Cloning</h3>
<p>The <code>git clone</code> command does a lot!<p>
<ul>
<li>Creates a local directory for the repo</li>
<li>Initializes that directory as a Git repo</li>
<li>Adds a remote connection called <code>origin</code> to the Github repo it was cloned from</li>
<li>Pulls from the Github repo so it's perfectly up-to-date</li>
</ul>
</section>
<section>
<h3>Cloning</h3>
<p>Add a remote connection to the <strong>original</strong> repository, so you can stay up to date with their changes:</p>
<pre><code class="command-line">
# Creates a remote connection, called "upstream",
# to the original repo on Github
git remote add upstream https://github.com/original-username/FORKED-REPO-NAME.git
# Pulls in changes not present in your local repository,
# without modifying your files
git fetch upstream
</code></pre>
</section>
<!-- Pull requests-->
<section>
<h3>Pull Requests</h3>
<ul>
<li>After you fork and clone a repository, all pushed changes will go to <strong>your</strong> fork</li>
<li>These changes will not affect the original repository</li>
<li>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>Pull Requests</h3>
<ul>
<li>Go to your GitResources directory</li>
<li>Add a resource to the list</li>
<li>Save, add, and commit your changes</li>
<li>Push your changes to your Github repo</li>
</ul>
<pre><code contenteditable class="command-line">
git add .
git commit -m "Add great new resource"
git push origin master
</code></pre>
</section>
<section>
<h3>Starting A Pull Request</h3>
<p>Visit <strong>your</strong> Github repo page</p>
<img src="img/pullrequestslink.png" alt="Go to Pull Requests."/>
<img src="img/newpullrequestbutton.png" alt="Start a new Pull Request."/>
</section>
<section>
<h3>Previewing And Sending Pull Request</h3>
<img src="img/pull-request.png" alt="How to preview and send a pull request. Image from https://help.github.com/articles/using-pull-requests"/>
<p>Fill out the form with a polite, helpful description, and submit.</p>
</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:20%" class="blue">?
<div class="clear"></div></div>
</section>
<section>
<h2>Thanks!</h2>
<p>Cheri Allen</p>
<p>@cherimarie</p>
</section>
<footer>
<div class="copyright">
GDI Intro to Git Workshop
<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="https://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>