-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
556 lines (526 loc) · 23.7 KB
/
index.html
File metadata and controls
556 lines (526 loc) · 23.7 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Git & GitHub Basics for TPMs</title>
<link rel="stylesheet" href="styles.css" />
<!-- Prevent flash of unstyled content when dark mode is preferred -->
<script>
(function () {
var prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
try {
var saved = localStorage.getItem('gh-basics-theme');
if (saved === 'dark' || (!saved && prefersDark)) {
document.documentElement.setAttribute('data-theme', 'dark');
}
} catch (e) {
/* localStorage unavailable (e.g. private mode) — apply system preference directly */
if (prefersDark) {
document.documentElement.setAttribute('data-theme', 'dark');
}
}
})();
</script>
</head>
<body>
<!-- Dark / light mode toggle -->
<button class="theme-toggle" id="themeToggle" onclick="toggleTheme()" aria-label="Toggle dark mode">🌙</button>
<!-- Hero -->
<header class="hero">
<div class="hero-content">
<div class="hero-icon">🐙</div>
<h1>Git & GitHub Basics</h1>
<p class="hero-subtitle">A quick, interactive guide for TPMs — no engineering degree required!</p>
<div class="progress-bar-container" aria-label="Course progress">
<div
class="progress-bar"
id="progressBar"
role="progressbar"
aria-valuemin="0"
aria-valuemax="100"
aria-valuenow="0"
aria-labelledby="progressLabel"></div>
<span class="progress-label" id="progressLabel"></span>
</div>
</div>
</header>
<!-- Nav tabs -->
<nav class="topic-nav" role="tablist" aria-label="Topics">
<button class="tab-btn active" role="tab" aria-selected="true" data-tab="what-is-git" onclick="showTab('what-is-git')">🔧 What is Git?</button>
<button class="tab-btn" role="tab" aria-selected="false" data-tab="repository" onclick="showTab('repository')">📦 Repository</button>
<button class="tab-btn" role="tab" aria-selected="false" data-tab="commit" onclick="showTab('commit')">💾 Commits</button>
<button class="tab-btn" role="tab" aria-selected="false" data-tab="branch-merge" onclick="showTab('branch-merge')">🌿 Branches & Merging</button>
<button class="tab-btn" role="tab" aria-selected="false" data-tab="pull-request" onclick="showTab('pull-request')">🔀 Pull Requests</button>
<button class="tab-btn" role="tab" aria-selected="false" data-tab="workflow" onclick="showTab('workflow')">🗺️ Full Workflow</button>
</nav>
<main class="content-area">
<!-- ── Tab 1: What is Git? ── -->
<section id="what-is-git" class="tab-panel active" role="tabpanel">
<div class="card">
<h2>🔧 What is Git?</h2>
<p>
<strong>Git</strong> is a <em>version control system</em>. Think of it like
<strong>"Track Changes" in Google Docs</strong> — but for code, and on steroids.
</p>
<div class="analogy-box">
<span class="analogy-icon">💡</span>
<div>
<strong>TPM analogy:</strong> Imagine every change your team makes to a project plan is
automatically saved with a timestamp, the author's name, and a note explaining what changed.
You can rewind to any earlier version at any time. That's Git.
</div>
</div>
<h3>Git vs GitHub — what's the difference?</h3>
<div class="comparison-grid">
<div class="compare-card git">
<div class="compare-icon">🛠️</div>
<h4>Git</h4>
<p>The <strong>tool</strong> that tracks changes on your computer. It's like the engine.</p>
</div>
<div class="compare-card github">
<div class="compare-icon">☁️</div>
<h4>GitHub</h4>
<p>A <strong>website</strong> that hosts Git repositories online so teams can collaborate. It's like Google Drive for code.</p>
</div>
</div>
<div class="key-points">
<h3>Key Takeaways</h3>
<ul>
<li>✅ Git tracks the full history of every change</li>
<li>✅ Multiple people can work on the same project without overwriting each other</li>
<li>✅ You can always roll back a mistake</li>
<li>✅ GitHub is where teams share and review those changes</li>
</ul>
</div>
<button class="mark-done-btn" data-topic="what-is-git" onclick="markDone('what-is-git', this)">Mark as Done ✓</button>
</div>
</section>
<!-- ── Tab 2: Repository ── -->
<section id="repository" class="tab-panel" role="tabpanel">
<div class="card">
<h2>📦 What is a Repository?</h2>
<p>
A <strong>repository</strong> (or "repo") is the <em>folder for your project</em> that Git
keeps track of. It contains all your files <em>plus</em> the entire history of every change
ever made to them.
</p>
<div class="analogy-box">
<span class="analogy-icon">💡</span>
<div>
<strong>TPM analogy:</strong> A repo is like a super-powered project folder in SharePoint —
it stores not just the current files, but every draft that was ever saved, who saved it,
and why.
</div>
</div>
<h3>Two types of repositories</h3>
<div class="comparison-grid">
<div class="compare-card git">
<div class="compare-icon">💻</div>
<h4>Local Repo</h4>
<p>Lives on <strong>your computer</strong>. You can work offline and experiment freely.</p>
</div>
<div class="compare-card github">
<div class="compare-icon">☁️</div>
<h4>Remote Repo (GitHub)</h4>
<p>Hosted on <strong>GitHub's servers</strong>. The shared "source of truth" your whole team syncs to.</p>
</div>
</div>
<!-- Interactive diagram -->
<h3>Interactive: Repo anatomy</h3>
<p>Click on each part of the repo to learn what it is:</p>
<div class="repo-diagram">
<div class="repo-folder" onclick="showRepoDetail('files')">
<span>📄</span> Files & Folders
</div>
<div class="repo-folder" onclick="showRepoDetail('history')">
<span>🕐</span> Commit History
</div>
<div class="repo-folder" onclick="showRepoDetail('branches')">
<span>🌿</span> Branches
</div>
<div class="repo-folder" onclick="showRepoDetail('issues')">
<span>🐛</span> Issues & PRs
</div>
</div>
<div class="repo-detail-box" id="repoDetailBox">
<em>👆 Click a part above to learn about it</em>
</div>
<div class="key-points">
<h3>Key Takeaways</h3>
<ul>
<li>✅ A repo = your project folder + all its history</li>
<li>✅ Every project has one repo (sometimes more for microservices)</li>
<li>✅ You can see the full history on GitHub under the "Commits" tab</li>
<li>✅ The default main branch is usually called <code>main</code></li>
</ul>
</div>
<button class="mark-done-btn" data-topic="repository" onclick="markDone('repository', this)">Mark as Done ✓</button>
</div>
</section>
<!-- ── Tab 3: Commits ── -->
<section id="commit" class="tab-panel" role="tabpanel">
<div class="card">
<h2>💾 What is a Commit?</h2>
<p>
A <strong>commit</strong> is a <em>saved snapshot</em> of your changes. When a developer
commits, Git takes a picture of everything that changed and stores it permanently with:
</p>
<div class="commit-anatomy">
<div class="commit-part" onclick="highlightPart(this)">
<div class="commit-part-icon">🆔</div>
<strong>Hash</strong>
<p>A unique ID (e.g., <code>a3f9c2b</code>)</p>
</div>
<div class="commit-part" onclick="highlightPart(this)">
<div class="commit-part-icon">✍️</div>
<strong>Author</strong>
<p>Who made the change</p>
</div>
<div class="commit-part" onclick="highlightPart(this)">
<div class="commit-part-icon">🕐</div>
<strong>Timestamp</strong>
<p>Exactly when it was saved</p>
</div>
<div class="commit-part" onclick="highlightPart(this)">
<div class="commit-part-icon">💬</div>
<strong>Message</strong>
<p>A short note explaining what changed</p>
</div>
<div class="commit-part" onclick="highlightPart(this)">
<div class="commit-part-icon">📝</div>
<strong>Diff</strong>
<p>The exact lines that were added or removed</p>
</div>
</div>
<div class="analogy-box">
<span class="analogy-icon">💡</span>
<div>
<strong>TPM analogy:</strong> A commit is like a version in Confluence — "v1.2 — added
acceptance criteria, @alice, March 6." Except Git captures <em>every single line</em>
that changed, automatically.
</div>
</div>
<!-- Mini timeline demo -->
<h3>A commit timeline</h3>
<div class="timeline">
<div class="timeline-item">
<div class="timeline-dot">1</div>
<div class="timeline-content">
<strong>Initial setup</strong>
<span class="timeline-meta">Bob • 3 days ago</span>
<p>Created the project</p>
</div>
</div>
<div class="timeline-item">
<div class="timeline-dot">2</div>
<div class="timeline-content">
<strong>Added login page</strong>
<span class="timeline-meta">Alice • 2 days ago</span>
<p>Built the login UI</p>
</div>
</div>
<div class="timeline-item">
<div class="timeline-dot">3</div>
<div class="timeline-content">
<strong>Fixed password bug</strong>
<span class="timeline-meta">Alice • 1 day ago</span>
<p>Fixed: passwords over 20 chars crashed</p>
</div>
</div>
<div class="timeline-item current">
<div class="timeline-dot">4</div>
<div class="timeline-content">
<strong>Add dark mode</strong>
<span class="timeline-meta">Carol • just now</span>
<p>Users can now toggle dark mode</p>
</div>
</div>
</div>
<div class="key-points">
<h3>Key Takeaways</h3>
<ul>
<li>✅ Commits are like save points — permanent and traceable</li>
<li>✅ Good commit messages help teammates (and future you!) understand what happened</li>
<li>✅ You can always go back to any commit</li>
<li>✅ Commits are <em>local</em> until you <strong>push</strong> them to GitHub</li>
</ul>
</div>
<button class="mark-done-btn" data-topic="commit" onclick="markDone('commit', this)">Mark as Done ✓</button>
</div>
</section>
<!-- ── Tab 4: Branches & Merging ── -->
<section id="branch-merge" class="tab-panel" role="tabpanel">
<div class="card">
<h2>🌿 Branches & Merging</h2>
<h3>What is a Branch?</h3>
<p>
A <strong>branch</strong> is like a <em>parallel copy</em> of the project where you can
safely make changes without affecting the main codebase. The main branch (usually called
<code>main</code>) is the "official" version of the project.
</p>
<div class="analogy-box">
<span class="analogy-icon">💡</span>
<div>
<strong>TPM analogy:</strong> Think of branching like creating a copy of a PRD to draft
a new feature spec — you work on the copy freely, and only update the official doc after
your changes are reviewed and approved.
</div>
</div>
<!-- Visual branch diagram -->
<h3>Visual: how branches work</h3>
<div class="branch-viz">
<div class="branch-line main-line">
<span class="branch-label">main</span>
<div class="branch-dots">
<div class="bdot filled" title="commit 1"></div>
<div class="bdot filled" title="commit 2"></div>
<div class="bdot" title="after merge"></div>
<div class="bdot filled after-merge" title="merged"></div>
</div>
</div>
<div class="branch-line feature-line">
<span class="branch-label">feature/login</span>
<div class="branch-dots">
<div class="bdot empty"></div>
<div class="bdot filled" title="feature commit 1"></div>
<div class="bdot filled" title="feature commit 2"></div>
<div class="bdot merge-arrow" title="merged into main">↗</div>
</div>
</div>
</div>
<h3>What is Merging?</h3>
<p>
<strong>Merging</strong> is the act of taking the changes from one branch and
combining them into another. This is how a feature goes from a developer's branch
into the <code>main</code> branch — and eventually to production.
</p>
<div class="analogy-box">
<span class="analogy-icon">💡</span>
<div>
<strong>TPM analogy:</strong> Merging is like folding the approved changes from your
draft PRD back into the official document — carefully, so nothing important is lost.
</div>
</div>
<h3>Commit vs Merge — key difference</h3>
<div class="comparison-grid">
<div class="compare-card git">
<div class="compare-icon">💾</div>
<h4>Commit</h4>
<p>Saves a <strong>snapshot of changes</strong> inside a branch. Like saving a draft.</p>
</div>
<div class="compare-card github">
<div class="compare-icon">🔗</div>
<h4>Merge</h4>
<p>Combines an <strong>entire branch</strong> into another. Like publishing the final doc.</p>
</div>
</div>
<div class="key-points">
<h3>Key Takeaways</h3>
<ul>
<li>✅ <code>main</code> is the stable, production-ready branch</li>
<li>✅ Always work on a feature branch — never directly on <code>main</code></li>
<li>✅ Merging brings the feature branch changes into <code>main</code></li>
<li>✅ Merges usually happen via a <strong>Pull Request</strong> so changes are reviewed first</li>
</ul>
</div>
<button class="mark-done-btn" data-topic="branch-merge" onclick="markDone('branch-merge', this)">Mark as Done ✓</button>
</div>
</section>
<!-- ── Tab 5: Pull Requests ── -->
<section id="pull-request" class="tab-panel" role="tabpanel">
<div class="card">
<h2>🔀 What is a Pull Request (PR)?</h2>
<p>
A <strong>Pull Request</strong> is a <em>formal proposal to merge your branch into
<code>main</code></em>. It gives your teammates a chance to review your changes,
leave comments, and approve (or request changes) before anything is merged.
</p>
<div class="analogy-box">
<span class="analogy-icon">💡</span>
<div>
<strong>TPM analogy:</strong> A PR is like a <em>change request review</em> in your
project. You submit your proposed changes, stakeholders review and comment, you address
feedback, and only after approval does it go live.
</div>
</div>
<!-- PR lifecycle -->
<h3>The PR lifecycle — step by step</h3>
<div class="pr-steps">
<div class="pr-step" onclick="toggleStep(this)">
<div class="pr-step-num">1</div>
<div class="pr-step-content">
<strong>Create a branch</strong>
<p>Developer creates a new branch for their feature or bug fix.</p>
</div>
</div>
<div class="pr-connector">↓</div>
<div class="pr-step" onclick="toggleStep(this)">
<div class="pr-step-num">2</div>
<div class="pr-step-content">
<strong>Make commits</strong>
<p>Developer writes code and commits changes to their branch.</p>
</div>
</div>
<div class="pr-connector">↓</div>
<div class="pr-step" onclick="toggleStep(this)">
<div class="pr-step-num">3</div>
<div class="pr-step-content">
<strong>Open a Pull Request</strong>
<p>On GitHub, open a PR: select your branch → base branch (<code>main</code>) → add a title & description.</p>
</div>
</div>
<div class="pr-connector">↓</div>
<div class="pr-step" onclick="toggleStep(this)">
<div class="pr-step-num">4</div>
<div class="pr-step-content">
<strong>Code Review</strong>
<p>Reviewers read the diff, leave comments, suggest changes. The author responds and updates commits.</p>
</div>
</div>
<div class="pr-connector">↓</div>
<div class="pr-step" onclick="toggleStep(this)">
<div class="pr-step-num">5</div>
<div class="pr-step-content">
<strong>Approval & Merge</strong>
<p>Once reviewers approve, the PR is merged into <code>main</code>. The branch is usually deleted.</p>
</div>
</div>
</div>
<h3>What a PR shows you (as a TPM)</h3>
<div class="pr-info-grid">
<div class="pr-info-card">
<span>📊</span>
<strong>Files changed</strong>
<p>Every file that was added, modified, or deleted</p>
</div>
<div class="pr-info-card">
<span>💬</span>
<strong>Discussions</strong>
<p>Inline comments on specific lines of code</p>
</div>
<div class="pr-info-card">
<span>✅</span>
<strong>Status checks</strong>
<p>Automated tests that must pass before merging</p>
</div>
<div class="pr-info-card">
<span>🔗</span>
<strong>Linked issues</strong>
<p>Which tickets or issues this PR resolves</p>
</div>
</div>
<div class="key-points">
<h3>Key Takeaways</h3>
<ul>
<li>✅ PRs are the main collaboration mechanism on GitHub</li>
<li>✅ Every change to <code>main</code> should go through a PR (best practice)</li>
<li>✅ As a TPM, PRs are where you can track what's being built and why</li>
<li>✅ Link PRs to Jira/Linear tickets for full traceability</li>
</ul>
</div>
<button class="mark-done-btn" data-topic="pull-request" onclick="markDone('pull-request', this)">Mark as Done ✓</button>
</div>
</section>
<!-- ── Tab 6: Full Workflow ── -->
<section id="workflow" class="tab-panel" role="tabpanel">
<div class="card">
<h2>🗺️ The Full Git Workflow</h2>
<p>
Here's how all the pieces fit together. This is the typical flow a developer follows
from starting a new feature to shipping it to production.
</p>
<!-- Interactive workflow -->
<div class="workflow-container">
<div class="workflow-step" id="wf-1" onclick="explainWorkflow(1)">
<div class="wf-icon">☁️</div>
<div class="wf-label">1. Clone / Pull</div>
</div>
<div class="wf-arrow">→</div>
<div class="workflow-step" id="wf-2" onclick="explainWorkflow(2)">
<div class="wf-icon">🌿</div>
<div class="wf-label">2. Branch</div>
</div>
<div class="wf-arrow">→</div>
<div class="workflow-step" id="wf-3" onclick="explainWorkflow(3)">
<div class="wf-icon">✍️</div>
<div class="wf-label">3. Code</div>
</div>
<div class="wf-arrow">→</div>
<div class="workflow-step" id="wf-4" onclick="explainWorkflow(4)">
<div class="wf-icon">💾</div>
<div class="wf-label">4. Commit</div>
</div>
<div class="wf-arrow">→</div>
<div class="workflow-step" id="wf-5" onclick="explainWorkflow(5)">
<div class="wf-icon">⬆️</div>
<div class="wf-label">5. Push</div>
</div>
<div class="wf-arrow">→</div>
<div class="workflow-step" id="wf-6" onclick="explainWorkflow(6)">
<div class="wf-icon">🔀</div>
<div class="wf-label">6. PR</div>
</div>
<div class="wf-arrow">→</div>
<div class="workflow-step" id="wf-7" onclick="explainWorkflow(7)">
<div class="wf-icon">🚀</div>
<div class="wf-label">7. Merge</div>
</div>
</div>
<div class="workflow-detail" id="workflowDetail">
<em>👆 Click a step above to learn more about it</em>
</div>
<!-- Quick Reference Cheat Sheet -->
<h3>📋 Quick Reference: Common Git Commands</h3>
<p class="cheatsheet-note">As a TPM you usually won't run these yourself, but it's good to know what your engineers are doing!</p>
<div class="cheat-sheet">
<div class="cheat-row header">
<span>Command</span><span>What it does</span>
</div>
<div class="cheat-row">
<code>git clone <url></code><span>Download a repo to your computer</span>
</div>
<div class="cheat-row">
<code>git pull</code><span>Get the latest changes from GitHub</span>
</div>
<div class="cheat-row">
<code>git checkout -b feature/name</code><span>Create and switch to a new branch</span>
</div>
<div class="cheat-row">
<code>git add .</code><span>Stage all changed files for commit</span>
</div>
<div class="cheat-row">
<code>git commit -m "message"</code><span>Save a snapshot with a description</span>
</div>
<div class="cheat-row">
<code>git push</code><span>Upload your commits to GitHub</span>
</div>
<div class="cheat-row">
<code>git status</code><span>See what files have changed</span>
</div>
<div class="cheat-row">
<code>git log</code><span>See the commit history</span>
</div>
</div>
<!-- Knowledge Check Quiz -->
<h3>🧠 Quick Knowledge Check</h3>
<div class="quiz-container" id="quizContainer"></div>
<div class="key-points">
<h3>🎉 You Did It!</h3>
<ul>
<li>✅ You know what Git and GitHub are</li>
<li>✅ You understand repositories, branches, and commits</li>
<li>✅ You know how PRs work and why they matter</li>
<li>✅ You can follow a conversation in any GitHub PR</li>
</ul>
</div>
<button class="mark-done-btn" data-topic="workflow" onclick="markDone('workflow', this)">Mark as Done ✓</button>
</div>
</section>
</main>
<footer class="site-footer">
<p>Built for TPM onboarding • Questions? Open a GitHub issue 😄</p>
</footer>
<script src="script.js"></script>
</body>
</html>