-
Notifications
You must be signed in to change notification settings - Fork 1
/
introduction.html
378 lines (337 loc) · 12.5 KB
/
introduction.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Git & GitHub</title>
<meta name="Introduction to Git and GitHub">
<meta name="author" content="Froilan Miranda">
<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="css/reveal.css">
<link rel="stylesheet" href="css/theme/solarized.css" id="theme">
<!-- Code syntax highlighting -->
<link rel="stylesheet" href="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="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<div class="slides">
<section><!------------------------------------ slide ---------------------------------------------->
<h1>Version Contriol</h1>
<h3>Introduction to Git and GitHub</h3>
<p>
<small>Created by <a href="http://www.zipcoder.io">Froilan Miranda</a></small>
</p>
</section>
<section><!------------------------------------ slide ---------------------------------------------->
<h2>Git</h2>
<p>
Git is a widely used source code management system for software development. It is a distributed revision control system with an emphasis on speed, data integrity, and support for distributed, non-linear workflows.
</p>
</section>
<section><!------------------------------------ slide ----------------------------------------------->
<section>
<h2>Initializing, adding, committing, and status</h2>
</section>
<section>
<h3>git init</h3>
<p>
This command creates an empty Git repository - basically a .git directory with
subdirectories for objects, refs/heads, refs/tags, and template files.
</p>
<pre><code data-trim>
//Transform the current directory into a Git repository.
git init
//Create an empty Git repository in the specified directory.
git init <directory>
</code></pre>
</section>
<section>
<h3>git add</h3>
<p>
This command updates the index using the current content found in the working tree,
to prepare the content staged for the next commit.
</p>
<pre><code data-trim>
//Stage all changes in <files> for the next commit.
git add <files>
//Stage all changes in <directory> for the next commit.
git add <directory>
</code></pre>
</section>
<section>
<h3>git status</h3>
<p>
Displays paths that have differences between the index file and the current HEAD
commit, paths that have differences between the working tree and the index file, and
paths in the working tree that are not tracked by Git (and are not ignored by
gitignore).
</p>
<pre><code data-trim>
//List which files are staged, unstaged, and untracked.
git status
</code></pre>
</section>
<section>
<h3>git commit</h3>
<p>
Stores the current contents of the index in a new commit along with a log message
from the user describing the changes.
</p>
<pre><code data-trim>
//Commit the staged snapshot and launch editor prompting for commit msg.
git commit
//Commit the staged snapshot and use <message> as the commit message.
git commit -m <message>
</code></pre>
</section>
</section>
<section><!------------------------------------ slide ----------------------------------------------->
<section>
<h2>Working with the staging environment</h2>
</section>
<section>
<h3>git checkout</h3>
<p>
This command serves three distinct functions: checking out files, checking out commits, and checking out branches. In this module, we’re only concerned with the first configuration.
</p>
<pre><code data-trim>
//Check out a previous version of a file.
git checkout <commit> <file>
</code></pre>
</section>
<section>
<h3>git reset</h3>
<p>
Remove the specified file from the staging area, but leave the working directory unchanged.
</p>
<pre><code data-trim>
//Remove the specified file from the staging area
git reset <file>
</code></pre>
</section>
</section>
<section><!------------------------------------ slide ----------------------------------------------->
<section>
<h2>Deleting files</h2>
</section>
<section>
<h3>git rm</h3>
<p>
Remove files from the index, or from the working tree and the index.
</p>
<pre><code data-trim>
//Remove files from the index
git rm <file>
//Remove files from the index
git rm --cached <file>
</code></pre>
</section>
</section>
<section><!------------------------------------ slide ----------------------------------------------->
<section>
<h2>Managing log</h2>
</section>
<section>
<h3>git log</h3>
<p>
This command displays committed snapshots. It lets you list the project history, filter it, and search for specific changes.
</p>
<pre><code data-trim>
//Shows the commit logs.
git log
</code></pre>
</section>
<section>
<h3>git checkout</h3>
<p>
This command serves three distinct functions: checking out files, checking out commits, and checking out branches. In this module, we’re only concerned with the second & third configurations.
</p>
<pre><code data-trim>
//Update working directory to match the specified commit.
git checkout <commit>
//Update working directory to match the specified branch
git checkout <branch-name>
</code></pre>
</section>
</section>
<section><!------------------------------------ slide ----------------------------------------------->
<section>
<h2>Deleting files</h2>
</section>
<section>
<h3>git rm</h3>
<p>
Remove files from the index, or from the working tree and the index.
</p>
<pre><code data-trim>
//Remove files from the index
git rm <file>
//Remove files from the index
git rm --cached <file>
</code></pre>
</section>
</section>
<section><!------------------------------------ slide ----------------------------------------------->
<section>
<h2>Controlling state with branches</h2>
</section>
<section>
<h3>git branch</h3>
<p>
Existing branches are listed; the current branch will be highlighted with an asterisk.
</p>
<pre><code data-trim>
//List all of the branches in your repository.
git branch
//Create a new branch called <branch>.
//This does not check out the new branch.
git branch <branch-name>
//Delete the specified branch.
git branch -d <branch-name>
//Rename the current branch
git branch -m <branch-name>
</code></pre>
</section>
<section>
<h3>git merge</h3>
<p>
Join two or more development histories together
</p>
<pre><code data-trim>
//Merge the specified branch into the current branch.
//Git will determine the merge algorithm automatically
git merge <branch-name>
</code></pre>
</section>
</section>
<section><!------------------------------------ slide ----------------------------------------------->
<section>
<h2>Analyzing a GitHub project structure</h2>
</section>
<section>
<h3>README.md</h3>
<p>
.md is markdown. README.md is used to generate the html summary you see at the bottom of projects. Github has their own flavor of Markdown.
</p>
<p><a href="http://daringfireball.net/projects/markdown/syntax" target="_blank">http://daringfireball.net/projects/markdown/syntax</a></p>
</section>
<section>
<h3>git .gitignore</h3>
<p>
Specifies intentionally untracked files to ignore
</p>
<p><a href="https://www.gitignore.io/" target="_blank">https://www.gitignore.io/</a></p>
</section>
</section>
<section><!------------------------------------ slide ----------------------------------------------->
<section>
<h2>Cloning a GitHub repo</h2>
</section>
<section>
<h3>use ssh <u>NOT</u> https</h3>
<p>
SSH keys are a way to identify trusted computers without involving passwords. You can generate an SSH key and add the public key to your GitHub account by following the procedures outlined in this section.</p>
<p><a href="https://help.github.com/articles/generating-an-ssh-key/" target="_blank">Generating an SSH key</a></p>
</section>
<section>
<h3>git clone</h3>
<p>Clone a repository into a new directory</p>
<pre><code data-trim>
//Clone the repository located at <repo> onto the local machine.
git clone <repo>
//Clone the repository located at <repo> into the folder
//called <directory> on the local machine.
git clone <repo> <directory>
</code></pre>
</section>
</section>
<section><!------------------------------------ slide ----------------------------------------------->
<section>
<h2>Sync with Repo</h2>
</section>
<section>
<h3>git push</h3>
<p>Updates remote refs using local refs, while sending objects necessary to complete the given refs.</p>
<pre><code data-trim>
//Push the specified branch to <remote>,
//along with all of the necessary commits and internal objects.
git push <remote> <branch>
</code></pre>
</section>
<section>
<h3>git fetch</h3>
<p>Download objects and refs from another repository</p>
<pre><code data-trim>
//Fetch all of the branches from the repository.
git fetch <remote>
</code></pre>
</section>
<section>
<h3>git pull</h3>
<p>Incorporates changes from a remote repository into the current branch.</p>
<pre><code data-trim>
//Fetch the specified remote’s copy of the current branch and
//immediately merge it into the local copy.
git pull <branch-name>
</code></pre>
</section>
</section>
<section><!------------------------------------slide----------------------------------------------->
<section>
<h2>Resources</h2>
</section>
<section>
<pre><code data-trim>
//Git manual
git help
git help <command>
</code></pre>
<p>
<ul>
<li><a href="https://git-scm.com/docs/git-init" target="_blank">https://git-scm.com</a></li>
<li><a href="https://www.atlassian.com/git/tutorials/setting-up-a-repository/" target="_blank">https://www.atlassian.com</a></li>
<li><a href="http://gitref.org/creating/" target="_blank">http://gitref.org</a></li>
<li><a href="https://training.github.com/kit/downloads/github-git-cheat-sheet.pdf" target="_blank">Git Cheet Sheet</a></li>
<li><a href="https://www.youtube.com/channel/UCP7RrmoueENv9TZts3HXXtw" target="_blank">Git & GitHub videos</a></li>
</ul>
</p>
</section>
</section>
</div><!-- slides -->
</div><!-- reveal -->
<script src="lib/js/head.min.js"></script>
<script src="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, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true },
{ src: 'plugin/notes/notes.js', async: true }
]
});
</script>
</body>
</html>