You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: add blank lines in exercises for proper list rendering
MkDocs requires a blank line between a paragraph and a numbered list.
Without it, Steps and Verify sections rendered as a single paragraph.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/02-Concepts/17-exercises.md
+40-10Lines changed: 40 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@ All exercises use a fresh, disposable repository unless stated otherwise.
10
10
**Task:** Initialize a new Git repository and explore its internal structure.
11
11
12
12
**Steps:**
13
+
13
14
1. Create a new directory called `concepts-lab` and navigate into it
14
15
2. Run `git init` to create a repository
15
16
3. List the contents of the `.git` directory
@@ -18,7 +19,9 @@ All exercises use a fresh, disposable repository unless stated otherwise.
18
19
6. Create a bare repository called `concepts-lab.git` in a sibling directory using `git init --bare`
19
20
7. Compare the directory structure of the bare repository with the `.git` folder
20
21
21
-
**Verify:** The `.git` directory exists and contains `objects`, `refs`, `HEAD`, and `config`. The bare repository has the same internal structure but no working tree.
22
+
**Verify:**
23
+
24
+
The `.git` directory exists and contains `objects`, `refs`, `HEAD`, and `config`. The bare repository has the same internal structure but no working tree.
22
25
23
26
---
24
27
@@ -27,6 +30,7 @@ All exercises use a fresh, disposable repository unless stated otherwise.
27
30
**Task:** Set user name and email at the local and global levels and observe which one takes precedence.
28
31
29
32
**Steps:**
33
+
30
34
1. Inside `concepts-lab`, set a global user name and email using `git config --global`
31
35
2. Set a different local user name and email using `git config --local`
32
36
3. Run `git config --list --show-origin` to see all active settings and their sources
@@ -35,7 +39,9 @@ All exercises use a fresh, disposable repository unless stated otherwise.
35
39
6. Remove the local overrides using `git config --local --unset user.name` and `git config --local --unset user.email`
36
40
7. Make another commit and verify the global identity is now used
37
41
38
-
**Verify:** The first commit shows the local identity. The second commit shows the global identity. `git config --list --show-origin` displays both levels and marks which file each setting comes from.
42
+
**Verify:**
43
+
44
+
The first commit shows the local identity. The second commit shows the global identity. `git config --list --show-origin` displays both levels and marks which file each setting comes from.
39
45
40
46
---
41
47
@@ -44,6 +50,7 @@ All exercises use a fresh, disposable repository unless stated otherwise.
44
50
**Task:** Create blobs, trees, and commits, then inspect them with plumbing commands.
45
51
46
52
**Steps:**
53
+
47
54
1. In `concepts-lab`, create a file called `hello.txt` with the content `Hello, Git!`
48
55
2. Stage the file with `git add hello.txt`
49
56
3. Run `git ls-files --stage` and note the blob hash next to the file name
@@ -55,7 +62,9 @@ All exercises use a fresh, disposable repository unless stated otherwise.
55
62
9. Verify that the tree references the same blob hash from step 3
56
63
10. Browse the `.git/objects` directory and locate the two-character subdirectory matching the first two characters of the blob hash
57
64
58
-
**Verify:**`git cat-file -p` on the blob prints `Hello, Git!`. The tree object lists the blob hash with mode `100644` and file name `hello.txt`. The corresponding object file exists on disk under `.git/objects`.
65
+
**Verify:**
66
+
67
+
`git cat-file -p` on the blob prints `Hello, Git!`. The tree object lists the blob hash with mode `100644` and file name `hello.txt`. The corresponding object file exists on disk under `.git/objects`.
59
68
60
69
---
61
70
@@ -64,6 +73,7 @@ All exercises use a fresh, disposable repository unless stated otherwise.
64
73
**Task:** Create both tag types and compare how Git stores them internally.
65
74
66
75
**Steps:**
76
+
67
77
1. In `concepts-lab`, make sure you have at least one commit
68
78
2. Create a lightweight tag called `v0.1` using `git tag v0.1`
69
79
3. Create an annotated tag called `v1.0` with the message `First release` using `git tag -a v1.0 -m "First release"`
@@ -73,7 +83,9 @@ All exercises use a fresh, disposable repository unless stated otherwise.
73
83
7. Run `git cat-file -t` on both hashes and compare the object types
74
84
8. Run `git cat-file -p` on the annotated tag hash and inspect the tagger, date, message, and target reference
75
85
76
-
**Verify:** The lightweight tag hash points directly to a commit object (`git cat-file -t` prints `commit`). The annotated tag hash points to a tag object (`git cat-file -t` prints `tag`), which in turn references the commit.
86
+
**Verify:**
87
+
88
+
The lightweight tag hash points directly to a commit object (`git cat-file -t` prints `commit`). The annotated tag hash points to a tag object (`git cat-file -t` prints `tag`), which in turn references the commit.
77
89
78
90
---
79
91
@@ -82,6 +94,7 @@ All exercises use a fresh, disposable repository unless stated otherwise.
82
94
**Task:** Use the index to selectively stage changes and observe its contents.
83
95
84
96
**Steps:**
97
+
85
98
1. In `concepts-lab`, create two files: `tracked.txt` and `experimental.txt`
86
99
2. Stage only `tracked.txt` with `git add tracked.txt`
87
100
3. Run `git ls-files --stage` to see what is in the index
@@ -92,7 +105,9 @@ All exercises use a fresh, disposable repository unless stated otherwise.
92
105
8. Run `git ls-files --stage` a final time and confirm only `tracked.txt` remains
93
106
9. Commit the staged file
94
107
95
-
**Verify:** After step 7, `git ls-files --stage` shows only `tracked.txt`. After the commit, `git status` shows `experimental.txt` as untracked and the working tree is otherwise clean.
108
+
**Verify:**
109
+
110
+
After step 7, `git ls-files --stage` shows only `tracked.txt`. After the commit, `git status` shows `experimental.txt` as untracked and the working tree is otherwise clean.
96
111
97
112
---
98
113
@@ -101,6 +116,7 @@ All exercises use a fresh, disposable repository unless stated otherwise.
101
116
**Task:** Practice the full branch lifecycle and observe how references change.
102
117
103
118
**Steps:**
119
+
104
120
1. In `concepts-lab`, confirm you are on the `main` branch with `git branch`
105
121
2. Read `.git/refs/heads/main` and note the commit hash
106
122
3. Create a new branch called `feature/greeting` using `git branch feature/greeting`
@@ -112,7 +128,9 @@ All exercises use a fresh, disposable repository unless stated otherwise.
112
128
9. Read `.git/refs/heads/main` and confirm it still points to the original commit
113
129
10. Switch back to `main` and delete the branch with `git branch -d feature/greeting`
114
130
115
-
**Verify:** After deletion, the file `.git/refs/heads/feature/greeting` no longer exists. `git branch` lists only `main`. The commit created on the feature branch becomes unreachable.
131
+
**Verify:**
132
+
133
+
After deletion, the file `.git/refs/heads/feature/greeting` no longer exists. `git branch` lists only `main`. The commit created on the feature branch becomes unreachable.
116
134
117
135
---
118
136
@@ -121,6 +139,7 @@ All exercises use a fresh, disposable repository unless stated otherwise.
121
139
**Task:** Create a merge conflict, inspect the conflict markers, and resolve it manually.
122
140
123
141
**Steps:**
142
+
124
143
1. In `concepts-lab`, create a file `config.txt` with the line `mode=production` and commit it on `main`
125
144
2. Create and switch to a branch `feature/debug` using `git switch -c feature/debug`
126
145
3. Change the line in `config.txt` to `mode=debug` and commit
@@ -132,7 +151,9 @@ All exercises use a fresh, disposable repository unless stated otherwise.
132
151
9. Edit `config.txt` to resolve the conflict by choosing one value or combining them
133
152
10. Stage the resolved file with `git add config.txt` and complete the merge with `git commit`
134
153
135
-
**Verify:** After the merge commit, `git log --oneline --graph` shows the two branches converging. `git ls-files --stage` shows a single stage-0 entry for `config.txt`. The file contains the resolved content with no conflict markers.
154
+
**Verify:**
155
+
156
+
After the merge commit, `git log --oneline --graph` shows the two branches converging. `git ls-files --stage` shows a single stage-0 entry for `config.txt`. The file contains the resolved content with no conflict markers.
136
157
137
158
---
138
159
@@ -141,6 +162,7 @@ All exercises use a fresh, disposable repository unless stated otherwise.
141
162
**Task:** Use the stash to save uncommitted changes, switch branches, then restore them.
142
163
143
164
**Steps:**
165
+
144
166
1. In `concepts-lab`, make sure you are on `main` with a clean working tree
145
167
2. Create a file `notes.txt` with the content `Work in progress`
146
168
3. Stage the file with `git add notes.txt`
@@ -152,7 +174,9 @@ All exercises use a fresh, disposable repository unless stated otherwise.
152
174
9. Restore the stashed changes with `git stash pop`
153
175
10. Confirm `notes.txt` is back in the working tree and staged
154
176
155
-
**Verify:** After `git stash pop`, `git status` shows `notes.txt` as a staged new file. `git stash list` is empty.
177
+
**Verify:**
178
+
179
+
After `git stash pop`, `git status` shows `notes.txt` as a staged new file. `git stash list` is empty.
156
180
157
181
---
158
182
@@ -161,6 +185,7 @@ All exercises use a fresh, disposable repository unless stated otherwise.
161
185
**Task:** Stage only some changes from a single file to make a focused commit.
162
186
163
187
**Steps:**
188
+
164
189
1. In `concepts-lab`, create a file `multi.txt` with three lines: `line1`, `line2`, `line3` and commit it
165
190
2. Modify the file so that `line1` becomes `LINE1` and `line3` becomes `LINE3` (leave `line2` unchanged)
166
191
3. Run `git diff` to confirm both hunks appear
@@ -170,7 +195,9 @@ All exercises use a fresh, disposable repository unless stated otherwise.
170
195
7. Commit the staged hunk
171
196
8. Stage and commit the remaining change
172
197
173
-
**Verify:**`git log --oneline` shows two separate commits. Running `git diff HEAD~1 HEAD~2` shows only the `line1` change. Running `git diff HEAD HEAD~1` shows only the `line3` change.
198
+
**Verify:**
199
+
200
+
`git log --oneline` shows two separate commits. Running `git diff HEAD~1 HEAD~2` shows only the `line1` change. Running `git diff HEAD HEAD~1` shows only the `line3` change.
174
201
175
202
---
176
203
@@ -179,6 +206,7 @@ All exercises use a fresh, disposable repository unless stated otherwise.
179
206
**Task:** Apply a simplified Git Flow workflow using branches and merges.
180
207
181
208
**Steps:**
209
+
182
210
1. Create a fresh repository called `flow-lab` and navigate into it
183
211
2. Create an initial commit on `main` with a file `app.txt` containing `v1.0`
184
212
3. Create a `develop` branch from `main` and switch to it
@@ -191,4 +219,6 @@ All exercises use a fresh, disposable repository unless stated otherwise.
191
219
10. Delete the release branch
192
220
11. Run `git log --oneline --graph --all` to visualize the full history
193
221
194
-
**Verify:**`main` and `develop` both contain the `v1.1` change and the `login.txt` file. The tag `v1.1` exists and points to the merge commit on `main`. The feature and release branches are deleted. The graph shows the expected merge topology.
222
+
**Verify:**
223
+
224
+
`main` and `develop` both contain the `v1.1` change and the `login.txt` file. The tag `v1.1` exists and points to the merge commit on `main`. The feature and release branches are deleted. The graph shows the expected merge topology.
0 commit comments