@shaykec/bridge 0.4.25 → 0.4.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/journeys/ai-engineer.yaml +34 -0
- package/journeys/backend-developer.yaml +36 -0
- package/journeys/business-analyst.yaml +37 -0
- package/journeys/devops-engineer.yaml +37 -0
- package/journeys/engineering-manager.yaml +44 -0
- package/journeys/frontend-developer.yaml +41 -0
- package/journeys/fullstack-developer.yaml +49 -0
- package/journeys/mobile-developer.yaml +42 -0
- package/journeys/product-manager.yaml +35 -0
- package/journeys/qa-engineer.yaml +37 -0
- package/journeys/ux-designer.yaml +43 -0
- package/modules/README.md +52 -0
- package/modules/accessibility-fundamentals/content.md +126 -0
- package/modules/accessibility-fundamentals/exercises.md +88 -0
- package/modules/accessibility-fundamentals/module.yaml +43 -0
- package/modules/accessibility-fundamentals/quick-ref.md +71 -0
- package/modules/accessibility-fundamentals/quiz.md +100 -0
- package/modules/accessibility-fundamentals/resources.md +29 -0
- package/modules/accessibility-fundamentals/walkthrough.md +80 -0
- package/modules/adr-writing/content.md +121 -0
- package/modules/adr-writing/exercises.md +81 -0
- package/modules/adr-writing/module.yaml +41 -0
- package/modules/adr-writing/quick-ref.md +57 -0
- package/modules/adr-writing/quiz.md +73 -0
- package/modules/adr-writing/resources.md +29 -0
- package/modules/adr-writing/walkthrough.md +64 -0
- package/modules/ai-agents/content.md +120 -0
- package/modules/ai-agents/exercises.md +82 -0
- package/modules/ai-agents/module.yaml +42 -0
- package/modules/ai-agents/quick-ref.md +60 -0
- package/modules/ai-agents/quiz.md +103 -0
- package/modules/ai-agents/resources.md +30 -0
- package/modules/ai-agents/walkthrough.md +85 -0
- package/modules/ai-assisted-research/content.md +136 -0
- package/modules/ai-assisted-research/exercises.md +80 -0
- package/modules/ai-assisted-research/module.yaml +42 -0
- package/modules/ai-assisted-research/quick-ref.md +67 -0
- package/modules/ai-assisted-research/quiz.md +73 -0
- package/modules/ai-assisted-research/resources.md +33 -0
- package/modules/ai-assisted-research/walkthrough.md +85 -0
- package/modules/ai-pair-programming/content.md +105 -0
- package/modules/ai-pair-programming/exercises.md +98 -0
- package/modules/ai-pair-programming/module.yaml +39 -0
- package/modules/ai-pair-programming/quick-ref.md +58 -0
- package/modules/ai-pair-programming/quiz.md +73 -0
- package/modules/ai-pair-programming/resources.md +34 -0
- package/modules/ai-pair-programming/walkthrough.md +117 -0
- package/modules/ai-test-generation/content.md +125 -0
- package/modules/ai-test-generation/exercises.md +98 -0
- package/modules/ai-test-generation/module.yaml +39 -0
- package/modules/ai-test-generation/quick-ref.md +65 -0
- package/modules/ai-test-generation/quiz.md +74 -0
- package/modules/ai-test-generation/resources.md +41 -0
- package/modules/ai-test-generation/walkthrough.md +100 -0
- package/modules/api-design/content.md +189 -0
- package/modules/api-design/exercises.md +84 -0
- package/modules/api-design/game.yaml +113 -0
- package/modules/api-design/module.yaml +45 -0
- package/modules/api-design/quick-ref.md +73 -0
- package/modules/api-design/quiz.md +100 -0
- package/modules/api-design/resources.md +55 -0
- package/modules/api-design/walkthrough.md +88 -0
- package/modules/clean-code/content.md +136 -0
- package/modules/clean-code/exercises.md +137 -0
- package/modules/clean-code/game.yaml +172 -0
- package/modules/clean-code/module.yaml +44 -0
- package/modules/clean-code/quick-ref.md +44 -0
- package/modules/clean-code/quiz.md +105 -0
- package/modules/clean-code/resources.md +40 -0
- package/modules/clean-code/walkthrough.md +78 -0
- package/modules/clean-code/workshop.yaml +149 -0
- package/modules/code-review/content.md +130 -0
- package/modules/code-review/exercises.md +95 -0
- package/modules/code-review/game.yaml +83 -0
- package/modules/code-review/module.yaml +42 -0
- package/modules/code-review/quick-ref.md +77 -0
- package/modules/code-review/quiz.md +105 -0
- package/modules/code-review/resources.md +40 -0
- package/modules/code-review/walkthrough.md +106 -0
- package/modules/daily-workflow/content.md +81 -0
- package/modules/daily-workflow/exercises.md +50 -0
- package/modules/daily-workflow/module.yaml +33 -0
- package/modules/daily-workflow/quick-ref.md +37 -0
- package/modules/daily-workflow/quiz.md +65 -0
- package/modules/daily-workflow/resources.md +38 -0
- package/modules/daily-workflow/walkthrough.md +83 -0
- package/modules/debugging-systematically/content.md +139 -0
- package/modules/debugging-systematically/exercises.md +91 -0
- package/modules/debugging-systematically/module.yaml +46 -0
- package/modules/debugging-systematically/quick-ref.md +59 -0
- package/modules/debugging-systematically/quiz.md +105 -0
- package/modules/debugging-systematically/resources.md +42 -0
- package/modules/debugging-systematically/walkthrough.md +84 -0
- package/modules/debugging-systematically/workshop.yaml +127 -0
- package/modules/demo-test/content.md +68 -0
- package/modules/demo-test/exercises.md +28 -0
- package/modules/demo-test/game.yaml +171 -0
- package/modules/demo-test/module.yaml +41 -0
- package/modules/demo-test/quick-ref.md +54 -0
- package/modules/demo-test/quiz.md +74 -0
- package/modules/demo-test/resources.md +21 -0
- package/modules/demo-test/walkthrough.md +122 -0
- package/modules/demo-test/workshop.yaml +31 -0
- package/modules/design-critique/content.md +93 -0
- package/modules/design-critique/exercises.md +71 -0
- package/modules/design-critique/module.yaml +41 -0
- package/modules/design-critique/quick-ref.md +63 -0
- package/modules/design-critique/quiz.md +73 -0
- package/modules/design-critique/resources.md +27 -0
- package/modules/design-critique/walkthrough.md +68 -0
- package/modules/design-patterns/content.md +335 -0
- package/modules/design-patterns/exercises.md +82 -0
- package/modules/design-patterns/game.yaml +55 -0
- package/modules/design-patterns/module.yaml +45 -0
- package/modules/design-patterns/quick-ref.md +44 -0
- package/modules/design-patterns/quiz.md +101 -0
- package/modules/design-patterns/resources.md +40 -0
- package/modules/design-patterns/walkthrough.md +64 -0
- package/modules/exploratory-testing/content.md +133 -0
- package/modules/exploratory-testing/exercises.md +88 -0
- package/modules/exploratory-testing/module.yaml +41 -0
- package/modules/exploratory-testing/quick-ref.md +68 -0
- package/modules/exploratory-testing/quiz.md +75 -0
- package/modules/exploratory-testing/resources.md +39 -0
- package/modules/exploratory-testing/walkthrough.md +87 -0
- package/modules/git/content.md +128 -0
- package/modules/git/exercises.md +53 -0
- package/modules/git/game.yaml +190 -0
- package/modules/git/module.yaml +44 -0
- package/modules/git/quick-ref.md +67 -0
- package/modules/git/quiz.md +89 -0
- package/modules/git/resources.md +49 -0
- package/modules/git/walkthrough.md +92 -0
- package/modules/git/workshop.yaml +145 -0
- package/modules/hiring-interviews/content.md +130 -0
- package/modules/hiring-interviews/exercises.md +88 -0
- package/modules/hiring-interviews/module.yaml +41 -0
- package/modules/hiring-interviews/quick-ref.md +68 -0
- package/modules/hiring-interviews/quiz.md +73 -0
- package/modules/hiring-interviews/resources.md +36 -0
- package/modules/hiring-interviews/walkthrough.md +75 -0
- package/modules/hooks/content.md +97 -0
- package/modules/hooks/exercises.md +69 -0
- package/modules/hooks/module.yaml +39 -0
- package/modules/hooks/quick-ref.md +93 -0
- package/modules/hooks/quiz.md +81 -0
- package/modules/hooks/resources.md +34 -0
- package/modules/hooks/walkthrough.md +105 -0
- package/modules/hooks/workshop.yaml +64 -0
- package/modules/incident-response/content.md +124 -0
- package/modules/incident-response/exercises.md +82 -0
- package/modules/incident-response/game.yaml +132 -0
- package/modules/incident-response/module.yaml +45 -0
- package/modules/incident-response/quick-ref.md +53 -0
- package/modules/incident-response/quiz.md +103 -0
- package/modules/incident-response/resources.md +40 -0
- package/modules/incident-response/walkthrough.md +82 -0
- package/modules/llm-fundamentals/content.md +114 -0
- package/modules/llm-fundamentals/exercises.md +83 -0
- package/modules/llm-fundamentals/module.yaml +42 -0
- package/modules/llm-fundamentals/quick-ref.md +64 -0
- package/modules/llm-fundamentals/quiz.md +103 -0
- package/modules/llm-fundamentals/resources.md +30 -0
- package/modules/llm-fundamentals/walkthrough.md +91 -0
- package/modules/one-on-ones/content.md +133 -0
- package/modules/one-on-ones/exercises.md +81 -0
- package/modules/one-on-ones/module.yaml +44 -0
- package/modules/one-on-ones/quick-ref.md +67 -0
- package/modules/one-on-ones/quiz.md +73 -0
- package/modules/one-on-ones/resources.md +37 -0
- package/modules/one-on-ones/walkthrough.md +69 -0
- package/modules/package.json +9 -0
- package/modules/prioritization-frameworks/content.md +130 -0
- package/modules/prioritization-frameworks/exercises.md +93 -0
- package/modules/prioritization-frameworks/module.yaml +41 -0
- package/modules/prioritization-frameworks/quick-ref.md +77 -0
- package/modules/prioritization-frameworks/quiz.md +73 -0
- package/modules/prioritization-frameworks/resources.md +32 -0
- package/modules/prioritization-frameworks/walkthrough.md +69 -0
- package/modules/prompt-engineering/content.md +123 -0
- package/modules/prompt-engineering/exercises.md +82 -0
- package/modules/prompt-engineering/game.yaml +101 -0
- package/modules/prompt-engineering/module.yaml +45 -0
- package/modules/prompt-engineering/quick-ref.md +65 -0
- package/modules/prompt-engineering/quiz.md +105 -0
- package/modules/prompt-engineering/resources.md +36 -0
- package/modules/prompt-engineering/walkthrough.md +81 -0
- package/modules/rag-fundamentals/content.md +111 -0
- package/modules/rag-fundamentals/exercises.md +80 -0
- package/modules/rag-fundamentals/module.yaml +45 -0
- package/modules/rag-fundamentals/quick-ref.md +58 -0
- package/modules/rag-fundamentals/quiz.md +75 -0
- package/modules/rag-fundamentals/resources.md +34 -0
- package/modules/rag-fundamentals/walkthrough.md +75 -0
- package/modules/react-fundamentals/content.md +140 -0
- package/modules/react-fundamentals/exercises.md +81 -0
- package/modules/react-fundamentals/game.yaml +145 -0
- package/modules/react-fundamentals/module.yaml +45 -0
- package/modules/react-fundamentals/quick-ref.md +62 -0
- package/modules/react-fundamentals/quiz.md +106 -0
- package/modules/react-fundamentals/resources.md +42 -0
- package/modules/react-fundamentals/walkthrough.md +89 -0
- package/modules/react-fundamentals/workshop.yaml +112 -0
- package/modules/react-native-fundamentals/content.md +141 -0
- package/modules/react-native-fundamentals/exercises.md +79 -0
- package/modules/react-native-fundamentals/module.yaml +42 -0
- package/modules/react-native-fundamentals/quick-ref.md +60 -0
- package/modules/react-native-fundamentals/quiz.md +61 -0
- package/modules/react-native-fundamentals/resources.md +24 -0
- package/modules/react-native-fundamentals/walkthrough.md +84 -0
- package/modules/registry.yaml +1650 -0
- package/modules/risk-management/content.md +162 -0
- package/modules/risk-management/exercises.md +86 -0
- package/modules/risk-management/module.yaml +41 -0
- package/modules/risk-management/quick-ref.md +82 -0
- package/modules/risk-management/quiz.md +73 -0
- package/modules/risk-management/resources.md +40 -0
- package/modules/risk-management/walkthrough.md +67 -0
- package/modules/running-effective-standups/content.md +119 -0
- package/modules/running-effective-standups/exercises.md +79 -0
- package/modules/running-effective-standups/module.yaml +40 -0
- package/modules/running-effective-standups/quick-ref.md +61 -0
- package/modules/running-effective-standups/quiz.md +73 -0
- package/modules/running-effective-standups/resources.md +36 -0
- package/modules/running-effective-standups/walkthrough.md +76 -0
- package/modules/solid-principles/content.md +154 -0
- package/modules/solid-principles/exercises.md +107 -0
- package/modules/solid-principles/module.yaml +42 -0
- package/modules/solid-principles/quick-ref.md +50 -0
- package/modules/solid-principles/quiz.md +102 -0
- package/modules/solid-principles/resources.md +39 -0
- package/modules/solid-principles/walkthrough.md +84 -0
- package/modules/sprint-planning/content.md +142 -0
- package/modules/sprint-planning/exercises.md +79 -0
- package/modules/sprint-planning/game.yaml +84 -0
- package/modules/sprint-planning/module.yaml +44 -0
- package/modules/sprint-planning/quick-ref.md +76 -0
- package/modules/sprint-planning/quiz.md +102 -0
- package/modules/sprint-planning/resources.md +39 -0
- package/modules/sprint-planning/walkthrough.md +75 -0
- package/modules/sql-fundamentals/content.md +160 -0
- package/modules/sql-fundamentals/exercises.md +87 -0
- package/modules/sql-fundamentals/game.yaml +105 -0
- package/modules/sql-fundamentals/module.yaml +45 -0
- package/modules/sql-fundamentals/quick-ref.md +53 -0
- package/modules/sql-fundamentals/quiz.md +103 -0
- package/modules/sql-fundamentals/resources.md +42 -0
- package/modules/sql-fundamentals/walkthrough.md +92 -0
- package/modules/sql-fundamentals/workshop.yaml +109 -0
- package/modules/stakeholder-communication/content.md +186 -0
- package/modules/stakeholder-communication/exercises.md +87 -0
- package/modules/stakeholder-communication/module.yaml +38 -0
- package/modules/stakeholder-communication/quick-ref.md +89 -0
- package/modules/stakeholder-communication/quiz.md +73 -0
- package/modules/stakeholder-communication/resources.md +41 -0
- package/modules/stakeholder-communication/walkthrough.md +74 -0
- package/modules/system-design/content.md +149 -0
- package/modules/system-design/exercises.md +83 -0
- package/modules/system-design/game.yaml +95 -0
- package/modules/system-design/module.yaml +46 -0
- package/modules/system-design/quick-ref.md +59 -0
- package/modules/system-design/quiz.md +102 -0
- package/modules/system-design/resources.md +46 -0
- package/modules/system-design/walkthrough.md +90 -0
- package/modules/team-topologies/content.md +166 -0
- package/modules/team-topologies/exercises.md +85 -0
- package/modules/team-topologies/module.yaml +41 -0
- package/modules/team-topologies/quick-ref.md +61 -0
- package/modules/team-topologies/quiz.md +101 -0
- package/modules/team-topologies/resources.md +37 -0
- package/modules/team-topologies/walkthrough.md +76 -0
- package/modules/technical-debt/content.md +111 -0
- package/modules/technical-debt/exercises.md +92 -0
- package/modules/technical-debt/module.yaml +39 -0
- package/modules/technical-debt/quick-ref.md +60 -0
- package/modules/technical-debt/quiz.md +73 -0
- package/modules/technical-debt/resources.md +25 -0
- package/modules/technical-debt/walkthrough.md +94 -0
- package/modules/technical-mentoring/content.md +128 -0
- package/modules/technical-mentoring/exercises.md +84 -0
- package/modules/technical-mentoring/module.yaml +41 -0
- package/modules/technical-mentoring/quick-ref.md +74 -0
- package/modules/technical-mentoring/quiz.md +73 -0
- package/modules/technical-mentoring/resources.md +33 -0
- package/modules/technical-mentoring/walkthrough.md +65 -0
- package/modules/test-strategy/content.md +136 -0
- package/modules/test-strategy/exercises.md +84 -0
- package/modules/test-strategy/game.yaml +99 -0
- package/modules/test-strategy/module.yaml +45 -0
- package/modules/test-strategy/quick-ref.md +66 -0
- package/modules/test-strategy/quiz.md +99 -0
- package/modules/test-strategy/resources.md +60 -0
- package/modules/test-strategy/walkthrough.md +97 -0
- package/modules/test-strategy/workshop.yaml +96 -0
- package/modules/typescript-fundamentals/content.md +127 -0
- package/modules/typescript-fundamentals/exercises.md +79 -0
- package/modules/typescript-fundamentals/game.yaml +111 -0
- package/modules/typescript-fundamentals/module.yaml +45 -0
- package/modules/typescript-fundamentals/quick-ref.md +55 -0
- package/modules/typescript-fundamentals/quiz.md +104 -0
- package/modules/typescript-fundamentals/resources.md +42 -0
- package/modules/typescript-fundamentals/walkthrough.md +71 -0
- package/modules/typescript-fundamentals/workshop.yaml +146 -0
- package/modules/user-story-mapping/content.md +123 -0
- package/modules/user-story-mapping/exercises.md +87 -0
- package/modules/user-story-mapping/module.yaml +41 -0
- package/modules/user-story-mapping/quick-ref.md +64 -0
- package/modules/user-story-mapping/quiz.md +73 -0
- package/modules/user-story-mapping/resources.md +29 -0
- package/modules/user-story-mapping/walkthrough.md +86 -0
- package/modules/writing-prds/content.md +133 -0
- package/modules/writing-prds/exercises.md +93 -0
- package/modules/writing-prds/game.yaml +83 -0
- package/modules/writing-prds/module.yaml +44 -0
- package/modules/writing-prds/quick-ref.md +77 -0
- package/modules/writing-prds/quiz.md +103 -0
- package/modules/writing-prds/resources.md +30 -0
- package/modules/writing-prds/walkthrough.md +87 -0
- package/package.json +1 -1
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Git - Version Control Fundamentals
|
|
2
|
+
|
|
3
|
+
<!-- hint:slides topic="Git fundamentals: three areas (working directory, staging, repository), branches, merging strategies, and conflict resolution" slides="5" -->
|
|
4
|
+
|
|
5
|
+
## What is Git?
|
|
6
|
+
|
|
7
|
+
Git is a distributed version control system that tracks changes in source code during software development. It allows multiple developers to work on the same codebase simultaneously without overwriting each other's work.
|
|
8
|
+
|
|
9
|
+
## Core Concepts
|
|
10
|
+
|
|
11
|
+
### Repository
|
|
12
|
+
A Git repository (repo) is a directory that Git tracks. It contains all your project files plus a hidden `.git` directory that stores the complete history of changes.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
git init # Create a new repository
|
|
16
|
+
git clone <url> # Clone an existing repository
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### The Three Areas
|
|
20
|
+
|
|
21
|
+
Git has three main areas where your files live:
|
|
22
|
+
|
|
23
|
+
1. **Working Directory** — your actual files on disk
|
|
24
|
+
2. **Staging Area (Index)** — files marked to be included in the next commit
|
|
25
|
+
3. **Repository (HEAD)** — the committed history
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Working Directory → git add → Staging Area → git commit → Repository
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```mermaid
|
|
32
|
+
flowchart LR
|
|
33
|
+
WD[Working Directory] -->|git add| SA[Staging Area]
|
|
34
|
+
SA -->|git commit| Repo[Repository]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Commits
|
|
38
|
+
|
|
39
|
+
A commit is a snapshot of your staged changes. Each commit has:
|
|
40
|
+
- A unique SHA-1 hash (e.g., `a1b2c3d`)
|
|
41
|
+
- Author and timestamp
|
|
42
|
+
- A commit message describing the change
|
|
43
|
+
- A pointer to its parent commit(s)
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
git add file.txt # Stage a file
|
|
47
|
+
git commit -m "message" # Commit staged changes
|
|
48
|
+
git log # View commit history
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Branches
|
|
52
|
+
|
|
53
|
+
A branch is a lightweight movable pointer to a commit. The default branch is usually `main` or `master`.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
git branch feature # Create a new branch
|
|
57
|
+
git checkout feature # Switch to it
|
|
58
|
+
git checkout -b feature # Create + switch in one step
|
|
59
|
+
git branch -d feature # Delete a branch
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Merging
|
|
63
|
+
|
|
64
|
+
Merging combines work from different branches.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
git checkout main
|
|
68
|
+
git merge feature # Merge feature into main
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Fast-forward merge:** When the target branch hasn't diverged, Git just moves the pointer forward.
|
|
72
|
+
|
|
73
|
+
**Three-way merge:** When both branches have new commits, Git creates a merge commit.
|
|
74
|
+
|
|
75
|
+
### Merge Conflicts
|
|
76
|
+
|
|
77
|
+
When Git can't automatically merge changes (both branches modified the same lines), you get a conflict:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
<<<<<<< HEAD
|
|
81
|
+
your changes
|
|
82
|
+
=======
|
|
83
|
+
their changes
|
|
84
|
+
>>>>>>> feature
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Resolve by editing the file, removing the markers, then:
|
|
88
|
+
```bash
|
|
89
|
+
git add file.txt
|
|
90
|
+
git commit
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Common Workflows
|
|
94
|
+
|
|
95
|
+
### Undoing Changes
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
git checkout -- file.txt # Discard working directory changes
|
|
99
|
+
git reset HEAD file.txt # Unstage a file
|
|
100
|
+
git revert <commit> # Create a new commit that undoes a previous one
|
|
101
|
+
git reset --hard <commit> # Dangerous: discard all changes after a commit
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Remote Repositories
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
git remote add origin <url> # Add a remote
|
|
108
|
+
git push origin main # Push to remote
|
|
109
|
+
git pull origin main # Fetch + merge from remote
|
|
110
|
+
git fetch origin # Fetch without merging
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Stashing
|
|
114
|
+
|
|
115
|
+
Temporarily save uncommitted changes:
|
|
116
|
+
```bash
|
|
117
|
+
git stash # Stash changes
|
|
118
|
+
git stash pop # Restore stashed changes
|
|
119
|
+
git stash list # List all stashes
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Best Practices
|
|
123
|
+
|
|
124
|
+
1. **Commit often** — small, focused commits are easier to understand and revert
|
|
125
|
+
2. **Write good commit messages** — explain WHY, not just WHAT
|
|
126
|
+
3. **Use branches** — keep main/master clean, develop features on branches
|
|
127
|
+
4. **Pull before push** — avoid merge conflicts by staying up to date
|
|
128
|
+
5. **Don't commit secrets** — use `.gitignore` for sensitive files
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Git Exercises
|
|
2
|
+
|
|
3
|
+
## Exercise 1: Selective Staging
|
|
4
|
+
|
|
5
|
+
**Task:** Create three files: `a.txt`, `b.txt`, `c.txt`. Commit only `a.txt` and `c.txt` in one commit, then `b.txt` in a separate commit.
|
|
6
|
+
|
|
7
|
+
**Validation:**
|
|
8
|
+
- [ ] `git log` shows exactly 2 new commits
|
|
9
|
+
- [ ] First commit contains only `a.txt` and `c.txt`
|
|
10
|
+
- [ ] Second commit contains only `b.txt`
|
|
11
|
+
|
|
12
|
+
**Hints:**
|
|
13
|
+
1. Use `git add` with specific filenames
|
|
14
|
+
2. Check `git status` between steps to verify what's staged
|
|
15
|
+
3. `git add a.txt c.txt` then `git commit`, then `git add b.txt` then `git commit`
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Exercise 2: Undo a Mistake
|
|
20
|
+
|
|
21
|
+
**Task:** Make a commit with a typo in the file content. Then use `git revert` to undo it without losing history.
|
|
22
|
+
|
|
23
|
+
**Validation:**
|
|
24
|
+
- [ ] The typo commit exists in the log
|
|
25
|
+
- [ ] A revert commit follows it
|
|
26
|
+
- [ ] The file no longer contains the typo
|
|
27
|
+
- [ ] `git log` shows both the mistake and the fix
|
|
28
|
+
|
|
29
|
+
**Hints:**
|
|
30
|
+
1. Commit the typo normally
|
|
31
|
+
2. `git revert HEAD` creates a new commit that undoes the last one
|
|
32
|
+
3. Check the file content after reverting
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Exercise 3: Branch Workflow
|
|
37
|
+
|
|
38
|
+
**Task:** Simulate a feature branch workflow:
|
|
39
|
+
1. Create a `develop` branch from `main`
|
|
40
|
+
2. Create a `feature/login` branch from `develop`
|
|
41
|
+
3. Make 2 commits on `feature/login`
|
|
42
|
+
4. Merge `feature/login` into `develop`
|
|
43
|
+
5. Merge `develop` into `main`
|
|
44
|
+
|
|
45
|
+
**Validation:**
|
|
46
|
+
- [ ] `main` contains all changes from the feature branch
|
|
47
|
+
- [ ] The branch history shows the correct merge path
|
|
48
|
+
- [ ] `git branch` shows only `main` (clean up branches after merge)
|
|
49
|
+
|
|
50
|
+
**Hints:**
|
|
51
|
+
1. Use `git checkout -b` to create and switch in one step
|
|
52
|
+
2. After merging, delete branches with `git branch -d`
|
|
53
|
+
3. Use `git log --graph --oneline` to visualize the history
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
games:
|
|
2
|
+
- type: command-sprint
|
|
3
|
+
title: "Git Command Sprint"
|
|
4
|
+
challenges:
|
|
5
|
+
- prompt: "Initialize a new Git repository in the current directory."
|
|
6
|
+
answer: "git init"
|
|
7
|
+
alternates: ["git init ."]
|
|
8
|
+
timeLimit: 18
|
|
9
|
+
- prompt: "Stage all changed files in the working directory."
|
|
10
|
+
answer: "git add ."
|
|
11
|
+
alternates: ["git add -A", "git add --all"]
|
|
12
|
+
timeLimit: 15
|
|
13
|
+
- prompt: "Create a commit with the message 'Add login form'."
|
|
14
|
+
answer: "git commit -m \"Add login form\""
|
|
15
|
+
alternates: ["git commit -m 'Add login form'"]
|
|
16
|
+
timeLimit: 20
|
|
17
|
+
- prompt: "Create and switch to a new branch named feature/auth."
|
|
18
|
+
answer: "git checkout -b feature/auth"
|
|
19
|
+
alternates: ["git switch -c feature/auth"]
|
|
20
|
+
timeLimit: 20
|
|
21
|
+
- prompt: "Show the commit log as a compact one-line-per-commit."
|
|
22
|
+
answer: "git log --oneline"
|
|
23
|
+
alternates: ["git log --oneline -n 20", "git log --pretty=oneline"]
|
|
24
|
+
timeLimit: 18
|
|
25
|
+
- prompt: "Discard all local changes in src/utils.js (restore to last commit)."
|
|
26
|
+
answer: "git checkout -- src/utils.js"
|
|
27
|
+
alternates: ["git restore src/utils.js"]
|
|
28
|
+
timeLimit: 22
|
|
29
|
+
- prompt: "Undo the last commit but keep your changes staged."
|
|
30
|
+
answer: "git reset --soft HEAD~1"
|
|
31
|
+
alternates: ["git reset --soft HEAD^"]
|
|
32
|
+
timeLimit: 22
|
|
33
|
+
- prompt: "Merge the main branch into your current branch."
|
|
34
|
+
answer: "git merge main"
|
|
35
|
+
alternates: ["git merge origin/main"]
|
|
36
|
+
timeLimit: 18
|
|
37
|
+
- prompt: "Rebase your current branch onto main."
|
|
38
|
+
answer: "git rebase main"
|
|
39
|
+
alternates: ["git rebase origin/main"]
|
|
40
|
+
timeLimit: 20
|
|
41
|
+
- prompt: "Abort an in-progress merge (return to pre-merge state)."
|
|
42
|
+
answer: "git merge --abort"
|
|
43
|
+
alternates: []
|
|
44
|
+
timeLimit: 20
|
|
45
|
+
|
|
46
|
+
- type: scenario
|
|
47
|
+
title: "Merge Conflict Crisis"
|
|
48
|
+
startHealth: 5
|
|
49
|
+
steps:
|
|
50
|
+
- id: start
|
|
51
|
+
situation: "You're on branch feature/checkout-ui. You haven't pulled from main in a week. Your teammate merged a big refactor. You run `git pull origin main` and Git reports merge conflicts in 3 files: src/App.jsx, src/components/Header.jsx, and package.json. What do you do first?"
|
|
52
|
+
choices:
|
|
53
|
+
- text: "Open each conflicted file and read the conflict markers."
|
|
54
|
+
consequence: "Smart. You inspect the conflicts before taking action."
|
|
55
|
+
health: 1
|
|
56
|
+
next: inspect
|
|
57
|
+
- text: "Run git merge --abort, then git pull --rebase origin main."
|
|
58
|
+
consequence: "Rebasing first can simplify conflicts, but you haven't seen them yet."
|
|
59
|
+
health: 0
|
|
60
|
+
next: rebase_path
|
|
61
|
+
- text: "Run git checkout --theirs . to accept all incoming changes."
|
|
62
|
+
consequence: "Danger! That discards all your work. You'd lose your feature code."
|
|
63
|
+
health: -2
|
|
64
|
+
next: bad_choice
|
|
65
|
+
- id: inspect
|
|
66
|
+
situation: "You open App.jsx and see conflict markers (<<<<<<< HEAD, =======, >>>>>>> main). The conflict is in the router setup: your version added a new route; main refactored the whole routing. What's your strategy?"
|
|
67
|
+
choices:
|
|
68
|
+
- text: "Manually resolve: keep my new route and adapt it to main's refactor."
|
|
69
|
+
consequence: "Correct. You integrate both sets of changes properly."
|
|
70
|
+
health: 1
|
|
71
|
+
next: resolve_one
|
|
72
|
+
- text: "Use git checkout --ours App.jsx to keep my version for this file."
|
|
73
|
+
consequence: "That keeps your route but may not work with main's refactor—integration issues ahead."
|
|
74
|
+
health: -1
|
|
75
|
+
next: ours_path
|
|
76
|
+
- text: "Delete the conflict markers and fix any syntax errors after."
|
|
77
|
+
consequence: "Risky. You might introduce broken code or lose logic."
|
|
78
|
+
health: -2
|
|
79
|
+
next: quick_fix
|
|
80
|
+
- id: resolve_one
|
|
81
|
+
situation: "You've resolved App.jsx. Header.jsx has a simpler conflict: both branches changed the same prop name. package.json has version conflicts. What next?"
|
|
82
|
+
choices:
|
|
83
|
+
- text: "Resolve Header.jsx and package.json, then git add . and git commit."
|
|
84
|
+
consequence: "Good. You resolve all files, stage them, and complete the merge."
|
|
85
|
+
health: 1
|
|
86
|
+
next: success
|
|
87
|
+
- text: "Run git add App.jsx only, commit, then deal with the others later."
|
|
88
|
+
consequence: "Leaving conflicts unresolved will block the merge. You need to fix all conflicted files."
|
|
89
|
+
health: -1
|
|
90
|
+
next: partial_fail
|
|
91
|
+
- text: "Use a merge tool (e.g. git mergetool) to resolve the rest."
|
|
92
|
+
consequence: "Using a tool is fine. You resolve the remaining conflicts."
|
|
93
|
+
health: 1
|
|
94
|
+
next: success
|
|
95
|
+
- id: rebase_path
|
|
96
|
+
situation: "You aborted and ran git pull --rebase. Now you're mid-rebase with conflicts. Git says 'Resolve conflicts, then run git add <file> and git rebase --continue.' What do you do?"
|
|
97
|
+
choices:
|
|
98
|
+
- text: "Resolve each conflicted file, git add them, then git rebase --continue."
|
|
99
|
+
consequence: "Right. That's the correct rebase flow."
|
|
100
|
+
health: 1
|
|
101
|
+
next: success
|
|
102
|
+
- text: "Run git rebase --skip to skip this commit."
|
|
103
|
+
consequence: "Only skip if you truly want to discard that commit. Usually you resolve."
|
|
104
|
+
health: -1
|
|
105
|
+
next: skip_warning
|
|
106
|
+
- text: "Run git rebase --abort to cancel the rebase entirely."
|
|
107
|
+
consequence: "You're back to square one. Merge might have been simpler."
|
|
108
|
+
health: -1
|
|
109
|
+
next: abort_path
|
|
110
|
+
- id: ours_path
|
|
111
|
+
situation: "You used --ours for App.jsx. Now Header.jsx and package.json still have conflicts. The build fails because your App.jsx doesn't match main's imports. What now?"
|
|
112
|
+
choices:
|
|
113
|
+
- text: "Undo the merge, then resolve all three files properly this time."
|
|
114
|
+
consequence: "Wise. Starting fresh with a careful resolve is better."
|
|
115
|
+
health: 1
|
|
116
|
+
next: start
|
|
117
|
+
- text: "Patch Header.jsx and package.json manually to fix the build."
|
|
118
|
+
consequence: "You salvage it, but it took extra work. Learning moment."
|
|
119
|
+
health: 0
|
|
120
|
+
next: success
|
|
121
|
+
- text: "Push as-is and ask your teammate to fix the build."
|
|
122
|
+
consequence: "Not a good habit. You own your merge resolution."
|
|
123
|
+
health: -2
|
|
124
|
+
next: bad_choice
|
|
125
|
+
- id: quick_fix
|
|
126
|
+
situation: "You removed the markers quickly. A test fails: the new route renders a 404. You realize you dropped a line during the quick fix. What do you do?"
|
|
127
|
+
choices:
|
|
128
|
+
- text: "Re-read the conflict, restore the correct logic, and re-run tests."
|
|
129
|
+
consequence: "Good recovery. Take your time with conflicts."
|
|
130
|
+
health: 1
|
|
131
|
+
next: success
|
|
132
|
+
- text: "Revert the merge commit and redo the merge more carefully."
|
|
133
|
+
consequence: "Also valid. Clean slate, proper resolution."
|
|
134
|
+
health: 0
|
|
135
|
+
next: success
|
|
136
|
+
- text: "Comment out the failing test and move on."
|
|
137
|
+
consequence: "Never a good idea. Tech debt and hidden bugs."
|
|
138
|
+
health: -2
|
|
139
|
+
next: bad_choice
|
|
140
|
+
- id: success
|
|
141
|
+
situation: "Merge complete. Your branch is updated with main, conflicts resolved, and the build passes. Well done!"
|
|
142
|
+
choices:
|
|
143
|
+
- text: "Continue working."
|
|
144
|
+
consequence: "You've navigated the merge conflict successfully."
|
|
145
|
+
health: 0
|
|
146
|
+
next: end
|
|
147
|
+
- id: partial_fail
|
|
148
|
+
situation: "Git won't complete the merge—there are still unmerged paths. You need to resolve and stage every conflicted file before committing."
|
|
149
|
+
choices:
|
|
150
|
+
- text: "Go back and resolve Header.jsx and package.json, then add and commit."
|
|
151
|
+
consequence: "You fix the mistake and complete the merge correctly."
|
|
152
|
+
health: 0
|
|
153
|
+
next: success
|
|
154
|
+
- text: "Give up and run git merge --abort."
|
|
155
|
+
consequence: "You abort and will need to redo the pull and resolution."
|
|
156
|
+
health: -1
|
|
157
|
+
next: abort_path
|
|
158
|
+
- id: skip_warning
|
|
159
|
+
situation: "You skipped a commit. If that commit had important changes, they're now gone. The rebase continues with more conflicts. Do you have more conflict resolution to do?"
|
|
160
|
+
choices:
|
|
161
|
+
- text: "Yes, resolve the next conflicts and git rebase --continue."
|
|
162
|
+
consequence: "You work through the remaining conflicts."
|
|
163
|
+
health: 0
|
|
164
|
+
next: success
|
|
165
|
+
- text: "Run git rebase --abort and try a regular merge instead."
|
|
166
|
+
consequence: "Sometimes merge is simpler than rebase when conflicts are many."
|
|
167
|
+
health: 0
|
|
168
|
+
next: abort_path
|
|
169
|
+
- id: abort_path
|
|
170
|
+
situation: "You've aborted. You're back on your branch before the merge/rebase. Main still has the refactor. What now?"
|
|
171
|
+
choices:
|
|
172
|
+
- text: "Pull with merge, then resolve conflicts carefully in all files."
|
|
173
|
+
consequence: "You try again with a clearer approach."
|
|
174
|
+
health: 0
|
|
175
|
+
next: start
|
|
176
|
+
- text: "Ask your teammate to resolve the conflicts for you."
|
|
177
|
+
consequence: "Learning to resolve conflicts is a core skill. Give it a shot."
|
|
178
|
+
health: -1
|
|
179
|
+
next: bad_choice
|
|
180
|
+
- id: bad_choice
|
|
181
|
+
situation: "That choice cost you. You've either lost work, created tech debt, or passed the buck. Merge conflicts demand care. Try to recover or restart."
|
|
182
|
+
choices:
|
|
183
|
+
- text: "Start over with a fresh mindset."
|
|
184
|
+
consequence: "Every conflict is a chance to practice."
|
|
185
|
+
health: 0
|
|
186
|
+
next: start
|
|
187
|
+
- text: "Accept the consequences and continue."
|
|
188
|
+
consequence: "Sometimes we learn the hard way."
|
|
189
|
+
health: 0
|
|
190
|
+
next: end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
slug: git
|
|
2
|
+
title: "Git - Version Control Fundamentals"
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: "Master Git from scratch — commits, branches, merges, and collaboration workflows."
|
|
5
|
+
category: developer-skills
|
|
6
|
+
tags: [git, version-control, terminal, collaboration]
|
|
7
|
+
difficulty: beginner
|
|
8
|
+
|
|
9
|
+
xp:
|
|
10
|
+
read: 10
|
|
11
|
+
walkthrough: 40
|
|
12
|
+
exercise: 25
|
|
13
|
+
quiz: 20
|
|
14
|
+
quiz-perfect-bonus: 10
|
|
15
|
+
game: 25
|
|
16
|
+
game-perfect-bonus: 15
|
|
17
|
+
|
|
18
|
+
time:
|
|
19
|
+
quick: 5
|
|
20
|
+
read: 15
|
|
21
|
+
guided: 45
|
|
22
|
+
|
|
23
|
+
prerequisites: []
|
|
24
|
+
related: [github, command-line]
|
|
25
|
+
|
|
26
|
+
triggers:
|
|
27
|
+
- "How do I undo a commit?"
|
|
28
|
+
- "What's the difference between merge and rebase?"
|
|
29
|
+
- "How do I resolve merge conflicts?"
|
|
30
|
+
- "How does Git branching work?"
|
|
31
|
+
|
|
32
|
+
visuals:
|
|
33
|
+
diagrams: [diagram-mermaid, diagram-flow]
|
|
34
|
+
quiz-types: [quiz-drag-order, quiz-timed-choice]
|
|
35
|
+
game-types: [command-sprint, scenario]
|
|
36
|
+
playground: bash
|
|
37
|
+
web-embeds: true
|
|
38
|
+
slides: true
|
|
39
|
+
|
|
40
|
+
sources:
|
|
41
|
+
- url: "https://git-scm.com/doc"
|
|
42
|
+
label: "Official Git Documentation"
|
|
43
|
+
- url: "https://git-scm.com/book/en/v2"
|
|
44
|
+
label: "Pro Git Book"
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Git Quick Reference
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
| Command | Purpose |
|
|
5
|
+
|---|---|
|
|
6
|
+
| `git init` | Create new repo |
|
|
7
|
+
| `git clone <url>` | Clone existing repo |
|
|
8
|
+
| `git config --global user.name "Name"` | Set name |
|
|
9
|
+
| `git config --global user.email "email"` | Set email |
|
|
10
|
+
|
|
11
|
+
## Daily Workflow
|
|
12
|
+
| Command | Purpose |
|
|
13
|
+
|---|---|
|
|
14
|
+
| `git status` | See what's changed |
|
|
15
|
+
| `git add <file>` | Stage specific file |
|
|
16
|
+
| `git add .` | Stage everything |
|
|
17
|
+
| `git commit -m "msg"` | Commit staged changes |
|
|
18
|
+
| `git diff` | See unstaged changes |
|
|
19
|
+
| `git diff --staged` | See staged changes |
|
|
20
|
+
| `git log --oneline` | Compact history |
|
|
21
|
+
|
|
22
|
+
## Branching
|
|
23
|
+
| Command | Purpose |
|
|
24
|
+
|---|---|
|
|
25
|
+
| `git branch` | List branches |
|
|
26
|
+
| `git branch <name>` | Create branch |
|
|
27
|
+
| `git checkout <name>` | Switch branch |
|
|
28
|
+
| `git checkout -b <name>` | Create + switch |
|
|
29
|
+
| `git merge <branch>` | Merge into current |
|
|
30
|
+
| `git branch -d <name>` | Delete branch |
|
|
31
|
+
|
|
32
|
+
## Remote
|
|
33
|
+
| Command | Purpose |
|
|
34
|
+
|---|---|
|
|
35
|
+
| `git remote -v` | List remotes |
|
|
36
|
+
| `git push origin <branch>` | Push branch |
|
|
37
|
+
| `git pull origin <branch>` | Fetch + merge |
|
|
38
|
+
| `git fetch` | Download only |
|
|
39
|
+
|
|
40
|
+
## Undo
|
|
41
|
+
| Scenario | Command |
|
|
42
|
+
|---|---|
|
|
43
|
+
| Discard working changes | `git checkout -- <file>` |
|
|
44
|
+
| Unstage a file | `git reset HEAD <file>` |
|
|
45
|
+
| Undo last commit (keep changes) | `git reset --soft HEAD~1` |
|
|
46
|
+
| Undo a pushed commit | `git revert <sha>` |
|
|
47
|
+
| Discard everything | `git reset --hard HEAD` |
|
|
48
|
+
|
|
49
|
+
## Stash
|
|
50
|
+
| Command | Purpose |
|
|
51
|
+
|---|---|
|
|
52
|
+
| `git stash` | Save dirty state |
|
|
53
|
+
| `git stash pop` | Restore + delete stash |
|
|
54
|
+
| `git stash list` | Show all stashes |
|
|
55
|
+
| `git stash drop` | Delete top stash |
|
|
56
|
+
|
|
57
|
+
## Decision Tree: "How Do I Undo?"
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
Did you commit it?
|
|
61
|
+
├── No → Is it staged?
|
|
62
|
+
│ ├── Yes → git reset HEAD <file>
|
|
63
|
+
│ └── No → git checkout -- <file>
|
|
64
|
+
└── Yes → Did you push it?
|
|
65
|
+
├── No → git reset --soft HEAD~1
|
|
66
|
+
└── Yes → git revert <sha>
|
|
67
|
+
```
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Git Quiz
|
|
2
|
+
|
|
3
|
+
## Question 1
|
|
4
|
+
|
|
5
|
+
What does `git add` do?
|
|
6
|
+
|
|
7
|
+
A) Commits your changes to the repository
|
|
8
|
+
B) Moves files from the working directory to the staging area
|
|
9
|
+
C) Creates a new file in the repository
|
|
10
|
+
D) Pushes your changes to a remote server
|
|
11
|
+
|
|
12
|
+
<!-- ANSWER: B -->
|
|
13
|
+
<!-- EXPLANATION: git add stages changes — it marks modified or new files to be included in the next commit. It moves them from the working directory to the staging area (index). It does NOT commit them or push them anywhere. -->
|
|
14
|
+
|
|
15
|
+
## Question 2
|
|
16
|
+
|
|
17
|
+
You have uncommitted changes on `main` and want to switch to another branch. What's the safest approach?
|
|
18
|
+
|
|
19
|
+
A) `git checkout other-branch` (just switch)
|
|
20
|
+
B) `git stash` then `git checkout other-branch`
|
|
21
|
+
C) `git reset --hard HEAD` then `git checkout other-branch`
|
|
22
|
+
D) `git commit -a -m "wip"` then `git checkout other-branch`
|
|
23
|
+
|
|
24
|
+
<!-- ANSWER: B -->
|
|
25
|
+
<!-- EXPLANATION: git stash temporarily saves your uncommitted changes so you can switch branches cleanly. Option A might fail or carry changes to the other branch. Option C would DESTROY your changes. Option D works but pollutes your commit history with "wip" commits. -->
|
|
26
|
+
|
|
27
|
+
## Question 3
|
|
28
|
+
|
|
29
|
+
What's the difference between `git fetch` and `git pull`?
|
|
30
|
+
|
|
31
|
+
A) They do the same thing
|
|
32
|
+
B) `fetch` downloads changes; `pull` downloads AND merges them
|
|
33
|
+
C) `fetch` is for branches; `pull` is for files
|
|
34
|
+
D) `pull` is faster because it skips the staging area
|
|
35
|
+
|
|
36
|
+
<!-- ANSWER: B -->
|
|
37
|
+
<!-- EXPLANATION: git fetch downloads changes from the remote but doesn't modify your working directory or current branch. git pull is essentially git fetch + git merge — it fetches AND integrates the changes. fetch is safer when you want to inspect changes before merging. -->
|
|
38
|
+
|
|
39
|
+
## Question 4
|
|
40
|
+
|
|
41
|
+
You accidentally committed a file with a secret API key. The commit has NOT been pushed. What should you do?
|
|
42
|
+
|
|
43
|
+
A) Delete the file and make a new commit
|
|
44
|
+
B) Use `git reset --soft HEAD~1` to undo the commit, remove the secret, recommit
|
|
45
|
+
C) Use `git revert HEAD` to undo the commit
|
|
46
|
+
D) Just add the file to `.gitignore`
|
|
47
|
+
|
|
48
|
+
<!-- ANSWER: B -->
|
|
49
|
+
<!-- EXPLANATION: git reset --soft HEAD~1 undoes the last commit but keeps changes staged. You can then remove the secret and recommit. Option A still leaves the secret in git history. Option C creates a revert commit but the secret remains in history. Option D only prevents future tracking, not past commits. Since the commit hasn't been pushed, reset is safe. -->
|
|
50
|
+
|
|
51
|
+
## Question 5
|
|
52
|
+
|
|
53
|
+
What happens when you create a new Git branch?
|
|
54
|
+
|
|
55
|
+
A) All files are copied to a new directory
|
|
56
|
+
B) A new pointer is created pointing to the current commit
|
|
57
|
+
C) A new repository is created
|
|
58
|
+
D) The working directory is cleared
|
|
59
|
+
|
|
60
|
+
<!-- ANSWER: B -->
|
|
61
|
+
<!-- EXPLANATION: A Git branch is just a lightweight pointer (40-byte file) to a commit SHA. No files are copied. This is why creating branches in Git is nearly instantaneous, unlike older version control systems like SVN that actually copied directories. -->
|
|
62
|
+
|
|
63
|
+
## Question 6
|
|
64
|
+
|
|
65
|
+
<!-- VISUAL: drag-order -->
|
|
66
|
+
|
|
67
|
+
Put these git commands in the correct order for a typical feature branch workflow:
|
|
68
|
+
|
|
69
|
+
A) `git add .`
|
|
70
|
+
B) `git checkout -b feature/my-feature`
|
|
71
|
+
C) `git push -u origin feature/my-feature`
|
|
72
|
+
D) `git commit -m "Implement feature"`
|
|
73
|
+
|
|
74
|
+
<!-- ANSWER: B,A,D,C -->
|
|
75
|
+
<!-- EXPLANATION: First create the branch (B), then stage changes (A), then commit (D), then push to set upstream (C). -->
|
|
76
|
+
|
|
77
|
+
## Question 7
|
|
78
|
+
|
|
79
|
+
<!-- VISUAL: drag-order -->
|
|
80
|
+
|
|
81
|
+
Put these steps in the correct order to resolve a merge conflict:
|
|
82
|
+
|
|
83
|
+
A) Edit the conflicted files to resolve the conflict
|
|
84
|
+
B) `git add` the resolved files
|
|
85
|
+
C) `git merge other-branch` (or pull, which triggers merge)
|
|
86
|
+
D) `git commit` to complete the merge
|
|
87
|
+
|
|
88
|
+
<!-- ANSWER: C,A,B,D -->
|
|
89
|
+
<!-- EXPLANATION: You merge first (C), which may create conflicts. Then edit the conflicted files (A), stage them (B), and commit to complete the merge (D). -->
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Git — Resources
|
|
2
|
+
|
|
3
|
+
## Official Docs
|
|
4
|
+
|
|
5
|
+
- [Git Reference Manual](https://git-scm.com/doc) — Complete command reference and man pages.
|
|
6
|
+
- [Pro Git Book (free online)](https://git-scm.com/book/en/v2) — Scott Chacon & Ben Straub. The definitive Git book, covers everything from basics to internals.
|
|
7
|
+
- [GitHub Docs — Git Handbook](https://docs.github.com/en/get-started/using-git/about-git) — Beginner-friendly Git overview from GitHub.
|
|
8
|
+
|
|
9
|
+
## Videos
|
|
10
|
+
|
|
11
|
+
- [Git Explained in 100 Seconds](https://www.youtube.com/watch?v=hwP7WQkmECE) — Fireship. Fast conceptual overview.
|
|
12
|
+
- [Git for Professionals](https://www.youtube.com/watch?v=Uszj_k0DGsg) — Tobias Günther (freeCodeCamp). Deeper workflows, rebase, reflog.
|
|
13
|
+
- [Git MERGE vs REBASE](https://www.youtube.com/watch?v=0chZFIZLR_0) — Fireship. Visual comparison of the two strategies.
|
|
14
|
+
- [So You Think You Know Git (FOSDEM 2024)](https://www.youtube.com/watch?v=aolI_Rz0ZqY) — Scott Chacon. Tips and lesser-known features.
|
|
15
|
+
- [How Git Works Under the Hood](https://www.youtube.com/watch?v=lG90LZotrpo) — Tech With Tim, 20 min. Understanding the object model (blobs, trees, commits).
|
|
16
|
+
- [Advanced Git Tutorial](https://www.youtube.com/watch?v=qsTthZi23VE) — Academind. Interactive rebase, cherry-pick, stash.
|
|
17
|
+
|
|
18
|
+
## Articles and Readings
|
|
19
|
+
|
|
20
|
+
- [Atlassian Git Tutorials](https://www.atlassian.com/git/tutorials) — Well-illustrated guides covering beginner to advanced topics.
|
|
21
|
+
- [Git Flight Rules](https://github.com/k88hudson/git-flight-rules) — GitHub repo. "What to do when things go wrong" — cookbook for common Git problems.
|
|
22
|
+
- [Conventional Commits](https://www.conventionalcommits.org/) — Specification for structured commit messages used by many teams.
|
|
23
|
+
- [A Visual Git Reference](https://marklodato.github.io/visual-git-guide/index-en.html) — Mark Lodato. Diagrams showing how each command changes the DAG.
|
|
24
|
+
- [Oh Shit, Git!?!](https://ohshitgit.com/) — Plain-English solutions for common Git mistakes.
|
|
25
|
+
|
|
26
|
+
## Books
|
|
27
|
+
|
|
28
|
+
- **Pro Git** by Scott Chacon & Ben Straub — Free, covers everything. [Read online](https://git-scm.com/book/en/v2).
|
|
29
|
+
- **Git Pocket Guide** by Richard E. Silverman — Quick reference for everyday commands.
|
|
30
|
+
|
|
31
|
+
## Interactive and Visual Tools
|
|
32
|
+
|
|
33
|
+
- [Learn Git Branching](https://learngitbranching.js.org/) — Interactive browser game that teaches branching, merging, and rebasing visually.
|
|
34
|
+
- [Oh My Git!](https://ohmygit.org/) — Open-source game that teaches Git with a visual interface.
|
|
35
|
+
- [Visualizing Git](https://git-school.github.io/visualizing-git/) — Type commands and see the commit graph update in real time.
|
|
36
|
+
- [GitHub Skills](https://skills.github.com/) — Hands-on courses that run directly in GitHub repos.
|
|
37
|
+
- [Git Explorer](https://gitexplorer.com/) — Find the right Git command by describing what you want to do.
|
|
38
|
+
|
|
39
|
+
## Podcasts
|
|
40
|
+
|
|
41
|
+
- [Changelog — Git episodes](https://changelog.com/topic/git) — Interviews with Git maintainers and workflow discussions.
|
|
42
|
+
- [Software Engineering Daily — Version Control](https://softwareengineeringdaily.com/?s=git) — Episodes covering Git internals and large-scale workflows.
|
|
43
|
+
|
|
44
|
+
## Tools
|
|
45
|
+
|
|
46
|
+
- [lazygit](https://github.com/jesseduffield/lazygit) — Terminal UI for Git that makes complex operations visual.
|
|
47
|
+
- [GitLens (VS Code)](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens) — In-editor blame, history, and comparison.
|
|
48
|
+
- [Meld](https://meldmerge.org/) — Visual diff and merge tool, useful for conflict resolution.
|
|
49
|
+
- [git-delta](https://github.com/dandavison/delta) — Syntax-highlighting pager for `git diff` output.
|