-
Notifications
You must be signed in to change notification settings - Fork 0
/
talk.html
384 lines (384 loc) · 13.8 KB
/
talk.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
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title></title>
<link rel="stylesheet" type="text/css" media="screen, projection, print"
href="http://www.w3.org/Talks/Tools/Slidy2/styles/slidy.css" />
<script src="http://www.w3.org/Talks/Tools/Slidy2/scripts/slidy.js.gz"
charset="utf-8" type="text/javascript"></script>
</head>
<body>
<div class="section slide level1" id="git-chips">
<h1>Git & Chips</h1>
<h3 id="git-initiation">git initiation</h3>
<h3 id="section">30.05.12</h3>
<h3 id="andreas-kundig-david-hodgetts">Andreas Kundig + David Hodgetts</h3>
<h3 id="made-possible-by-pro-git-book">made possible by "Pro Git" book</h3>
<h3 id="httpgit-scm.combook">http://git-scm.com/book</h3>
<h3 id="authored-by-scott-chacon">authored by Scott Chacon</h3>
<h3 id="creative-commons">creative commons</h3>
</div>
<div class="section slide level1" id="what-is-git">
<h1>what is git</h1>
<ul class="incremental">
<li><p>distributed version control</p></li>
<li><div class="figure">
<img src="images/distributed.png" /><p class="caption"></p>
</div></li>
</ul>
</div>
<div class="section slide level1" id="some-defining-features">
<h1>some defining features</h1>
<ul class="incremental">
<li><p>stores snaphots</p></li>
<li><div class="figure">
<img src="images/snapshots.png" /><p class="caption"></p>
</div></li>
<li><p>not diffs</p></li>
<li><div class="figure">
<img src="images/snapshotsDiff.png" /><p class="caption"></p>
</div></li>
<li><p>local operations possible</p></li>
<li><p>git integrity (sha1)</p></li>
<li><p>you only ever really add data</p></li>
</ul>
</div>
<div class="section slide level1" id="local-operations">
<h1>local operations</h1>
<ul class="incremental">
<li><img src="images/localOperations.png" /></li>
</ul>
</div>
<div class="section slide level1" id="installation">
<h1>installation</h1>
<ul class="incremental">
<li><p>linux -> apt-get install git-core</p></li>
<li><p>mac -> http://code.google.com/p/git-osx-installer</p></li>
<li><p>mac -> homebrew -> http://mxcl.github.com/homebrew/</p></li>
<li><p>windows -> http://code.google.com/p/msysgit</p></li>
<li><p>windows -> http://cygwin.com</p></li>
</ul>
</div>
<div class="section slide level1" id="first-time-configuration">
<h1>first time configuration</h1>
<ul class="incremental">
<li><p>git config --global user.name "Andreas Kundig"</p></li>
<li><p>git config --global user.email [email protected]</p></li>
<li><p>git config --global core.editor "mate -w"</p></li>
<li><p>more configs -> http://www.arthurkoziel.com/2008/05/02/git-configuration/</p></li>
<li><p>git config --list</p></li>
</ul>
</div>
<div class="section slide level1" id="my-first-repo">
<h1>my first repo</h1>
<ul class="incremental">
<li><p>git init</p></li>
<li><p>git status</p></li>
<li><p>git add myFile</p></li>
<li><p>git commit</p></li>
<li><p>git commit -m "commit message: i can haz cheeseburger"</p></li>
</ul>
</div>
<div class="section slide level1" id="cloning-an-existing-repo">
<h1>cloning an existing repo</h1>
<ul class="incremental">
<li><p>git clone [url]</p></li>
<li><p>git clone git://github.com/user/repo.git</p></li>
<li><p>git clone https://github.com/user/repo.git</p></li>
<li><p>git clone [email protected]:git/myrepo.git</p></li>
</ul>
</div>
<div class="section slide level1" id="file-status">
<h1>file status</h1>
<ul class="incremental">
<li><p>files can be tracked (files that were in the last snapshot) or untracked</p></li>
<li><p>tracked files can be unmodified, modified or staged</p></li>
<li><div class="figure">
<img src="images/fileLifecycle.png" /><p class="caption"></p>
</div></li>
<li><p>git status</p></li>
<li><div class="figure">
<img src="images/localOperations.png" /><p class="caption"></p>
</div></li>
</ul>
</div>
<div class="section slide level1" id="dont-ignore-me">
<h1>don't ignore me</h1>
<p>.gitignore</p>
<pre><code># a comment - this is ignored
*.a # no .a files
!lib.a # but do track lib.a, even though you're ignoring .a files above
/TODO # only ignore the root TODO file, not subdir/TODO
build/ # ignore all files in the build/ directory
doc/*.txt # ignore doc/notes.txt, but not doc/server/arch.txt</code></pre>
</div>
<div class="section slide level1" id="skip-the-staging-area">
<h1>skip the staging area</h1>
<ul class="incremental">
<li>git commit -am "commit all changes on tracked files but not any new files"</li>
</ul>
</div>
<div class="section slide level1" id="mv---rm">
<h1>mv - rm</h1>
<ul class="incremental">
<li><p>git mv oldFilename newFilename</p></li>
<li><p>git rm file # removes from repo and working directory</p></li>
<li><p>git rm --cached file # only removes from repo (file no longer tracked but on working dir)</p></li>
</ul>
</div>
<div class="section slide level1" id="viewing-the-commit-history">
<h1>viewing the commit history</h1>
<ul class="incremental">
<li><p>git log</p></li>
<li><p>git log -p -2</p></li>
<li><p>git log --stat</p></li>
<li><p>git log --pretty=oneline</p></li>
<li><p>git log --pretty=format:"%h %s" --graph</p></li>
<li><p>git log --graph --decorate --oneline</p></li>
</ul>
</div>
<div class="section slide level1" id="undoing-stuff">
<h1>undoing stuff</h1>
<ul class="incremental">
<li><p>git commit --amend</p></li>
<li><p>unstaging staged file -> check out git status -> git reset HEAD fileName</p></li>
<li><p>unmodifying a modified file (not staged) -> look at git status -> git checkout -- fileName</p></li>
</ul>
</div>
<div class="section slide level1" id="git-branching">
<h1>Git Branching</h1>
<ul class="incremental">
<li><p>single commit</p></li>
<li><div class="figure">
<img src="images/singleCommitTree.png" /><p class="caption"></p>
</div></li>
<li><p>we add some commits</p></li>
<li><div class="figure">
<img src="images/multipleCommits.png" /><p class="caption"></p>
</div></li>
</ul>
</div>
<div class="section slide level1" id="so-a-branch-is-...">
<h1>so a branch is ...</h1>
<ul class="incremental">
<li><p>a movable pointer to one of these commits</p></li>
<li><p>default branch is called "master"</p></li>
<li><div class="figure">
<img src="images/branchPointer.png" /><p class="caption"></p>
</div></li>
</ul>
</div>
<div class="section slide level1" id="creating-a-new-branch-means-...">
<h1>creating a new branch means ...</h1>
<ul class="incremental">
<li><p>adding a new movable pointer</p></li>
<li><p>git branch testing</p></li>
<li><div class="figure">
<img src="images/newBranch.png" /><p class="caption"></p>
</div></li>
</ul>
</div>
<div class="section slide level1" id="ok-but-how-does-git-know-on-which-branch-i-am">
<h1>ok but how does Git know on which branch i am?</h1>
<ul class="incremental">
<li><p>it uses a special pointer called HEAD</p></li>
<li><div class="figure">
<img src="images/headOnMaster.png" /><p class="caption"></p>
</div></li>
<li><p>if we change branches: git checkout testing</p></li>
<li><div class="figure">
<img src="images/headOnTesting.png" /><p class="caption"></p>
</div></li>
</ul>
</div>
<div class="section slide level1" id="head-moves-with-the-new-commits-on-current-branch">
<h1>HEAD moves with the new commits on current branch</h1>
<ul class="incremental">
<li><p>modify file on testing + commit on testing</p></li>
<li><div class="figure">
<img src="images/headMovedOnTesting.png" /><p class="caption"></p>
</div></li>
<li><p>git checkout master</p></li>
<li><div class="figure">
<img src="images/headBackOnMaster.png" /><p class="caption"></p>
</div></li>
</ul>
</div>
<div class="section slide level1" id="alternate-history">
<h1>alternate history</h1>
<ul class="incremental">
<li><p>let's do some work on master and commit</p></li>
<li><div class="figure">
<img src="images/headMovedOnMaster.png" /><p class="caption"></p>
</div></li>
<li><p>mmm but how do i reconcile my diverging branches? ...</p></li>
</ul>
</div>
<div class="section slide level1" id="merging">
<h1>merging</h1>
<ul class="incremental">
<li><p>a new project on my supersite for my superstartup</p></li>
<li><div class="figure">
<img src="images/supersiteStart.png" /><p class="caption"></p>
</div></li>
<li><p>let's work on issue 53</p></li>
<li><p>git checkout -b iss53 (same as "git branch iss53" followed by "git checkout iss53")</p></li>
<li><div class="figure">
<img src="images/createdIss53.png" /><p class="caption"></p>
</div></li>
<li><p>do some work and commit</p></li>
<li><div class="figure">
<img src="images/commitOnIss53.png" /><p class="caption"></p>
</div></li>
</ul>
</div>
<div class="section slide level1" id="oh-boy-there-is-an-urgent-fix-required-on-the-production-version-master">
<h1>oh boy there is an urgent fix required on the production version (master)</h1>
<ul class="incremental">
<li><p>commit your work on iss53</p></li>
<li><p>checkout master</p></li>
<li><p>create a hotfix branch on master -> git checkout -b hotfix</p></li>
<li><p>do the fix and commit</p></li>
<li><div class="figure">
<img src="images/hotfixBranch.png" /><p class="caption"></p>
</div></li>
</ul>
</div>
<div class="section slide level1" id="if-hotfix-is-approved-we-can-merge-it-back-into-master">
<h1>if hotfix is approved we can merge it back into master</h1>
<ul class="incremental">
<li><p>git checkout master</p></li>
<li><p>git merge hotfix</p></li>
<li><div class="figure">
<img src="images/fastForward.png" /><p class="caption"></p>
</div></li>
<li><p>master is "fast forwarded" (the pointer has just to move point to the same commit as hotfix)</p></li>
<li><p>hotfix branch no longer needed -> git branch -d hotfix</p></li>
</ul>
</div>
<div class="section slide level1" id="get-back-to-work-on-issue-53">
<h1>get back to work on issue 53</h1>
<ul class="incremental">
<li><p>git checkout iss53</p></li>
<li><p>do work and commit</p></li>
<li><div class="figure">
<img src="images/moreWorkOnIss53.png" /><p class="caption"></p>
</div></li>
</ul>
</div>
<div class="section slide level1" id="we-assume-work-is-done-on-issue-53-we-want-to-merge-work-back-into-master">
<h1>we assume work is done on issue 53 we want to merge work back into master</h1>
<ul class="incremental">
<li><p>git checkout master</p></li>
<li><p>git merge iss53</p></li>
<li><p>Fast forward not possible</p></li>
<li><div class="figure">
<img src="images/moreWorkOnIss53.png" /><p class="caption"></p>
</div></li>
</ul>
</div>
<div class="section slide level1" id="git-does-a-3-way-merge">
<h1>git does a 3 way merge</h1>
<ul class="incremental">
<li><p>(master, iss53 and first common ancestor)</p></li>
<li><div class="figure">
<img src="images/3wayMerge.png" /><p class="caption"></p>
</div></li>
<li><p>result:</p></li>
<li><div class="figure">
<img src="images/3wayMergeResult.png" /><p class="caption"></p>
</div></li>
</ul>
</div>
<div class="section slide level1" id="merge-conflicts">
<h1>merge conflicts</h1>
<ul class="incremental">
<li><img src="images/3wayMerge.png" /></li>
</ul>
</div>
<div class="section slide level1" id="branch-management">
<h1>branch management</h1>
<ul class="incremental">
<li><p>git branch</p></li>
<li><p>git branch -a</p></li>
<li><p>git branch -r</p></li>
<li><p>git branch --merged (shows branches that are already merged on current branch)</p></li>
<li><p>delete branch: git branch -d</p></li>
</ul>
</div>
<div class="section slide level1" id="remotes-and-remote-branches">
<h1>remotes and remote branches</h1>
<ul class="incremental">
<li><p>git clone supersite</p></li>
<li><div class="figure">
<img src="images/gitClone.png" /><p class="caption"></p>
</div></li>
<li><p>Remote branches act as bookmarks to remind you where the branches on your remote repositories were the last time you connected to them.</p></li>
<li><p>remote/branch</p></li>
<li><p>origin/master</p></li>
<li><p>pierre/development</p></li>
</ul>
</div>
<div class="section slide level1" id="remote-management">
<h1>remote management</h1>
<ul class="incremental">
<li><p>git remote</p></li>
<li><p>git remote show origin</p></li>
<li><p>git remote add repoOfAndreas git://github.com/repoOfAndreas.git</p></li>
<li><p>git remote show repoOfAndreas</p></li>
<li><p>git remote rename oldName newName</p></li>
<li><p>git remote rm repoOfAndreas (removes remote named repoOfAndreas)</p></li>
</ul>
</div>
<div class="section slide level1" id="how-does-it-work">
<h1>how does it work?</h1>
<ul class="incremental">
<li><p>someone works on the projet and pushes to origin</p></li>
<li><div class="figure">
<img src="images/pushOnOrigin.png" /><p class="caption"></p>
</div></li>
<li><p>histories diverge, again...</p></li>
</ul>
</div>
<div class="section slide level1" id="sync-with-remote">
<h1>sync with remote</h1>
<ul class="incremental">
<li><p>git fetch origin</p></li>
<li><div class="figure">
<img src="images/gitFetch.png" /><p class="caption"></p>
</div></li>
<li><p>git log origin/master</p></li>
<li><p>git diff master origin/master</p></li>
<li><p>git merge origin/master</p></li>
</ul>
</div>
<div class="section slide level1" id="you-can-also-use-pull-instead-of-fetch">
<h1>you can also use Pull instead of Fetch</h1>
<ul class="incremental">
<li><p>pull does :</p></li>
<li><p>git fetch + git merge into current branch</p></li>
<li><p>but it's a not really the git way</p></li>
</ul>
</div>
<div class="section slide level1" id="push-your-work">
<h1>Push your work</h1>
<ul class="incremental">
<li><p>git push</p></li>
<li><p>git push remoteName branchName</p></li>
<li><p>git push origin master</p></li>
</ul>
</div>
<div class="section slide level1" id="whats-next">
<h1>what's next</h1>
<ul class="incremental">
<li><p>http://git-scm.com/documentation/external-links</p></li>
<li><p>stackoverflow</p></li>
</ul>
</div>
</body>
</html>