summaryrefslogtreecommitdiffstats
path: root/docs/policies/BRANCHING-POLICY.md
blob: ddc513880da43252409214e0541a9a71c27aa0a5 (plain)
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
# Weekly Branching Policy

**Effective Date:** Week 3 (2026-04-17 onwards)  
**Status:** ✅ Active

---

## Executive Summary

Starting with Week 3, each week of implementation work will use a **feature branch** to isolate changes, enable code review, and ensure safe integration into the main `master` branch.

**Format:** `week-<number>-<description>`  
**Example:** `week-3-cards-nav`, `week-4-forms-interactions`

---

## Why Weekly Branching?

### 1. Code Review
Each week's work can be reviewed as a complete unit before merging to master.

### 2. Safety
If issues are discovered, the feature branch can be easily discarded without affecting master. Easy rollback if needed.

### 3. Isolation
Each week's work is independent. Less chance of accidental changes or conflicts affecting master.

### 4. Clean History
Git log shows logical, week-based commits instead of intermingled changes.

### 5. Testing
Entire week's work can be tested on the feature branch before merging. Catch issues before they affect master.

---

## Weekly Workflow

### Week 3 (and beyond)

```
┌─── master (stable, always works)

├─ week-3-cards-nav (feature branch)
│  ├─ commit 1: add card component
│  ├─ commit 2: add navigation header
│  ├─ commit 3: add hamburger menu
│  ├─ commit 4: add breadcrumbs
│  └─ [TESTED & REVIEWED]

└─ Merge to master when ready
   └─ master now has Week 3 changes
```

---

## Step-by-Step Instructions

### 1. Start of Week

```bash
# Ensure master is up to date
git checkout master
git pull origin master  # if using remote

# Create feature branch
git checkout -b week-3-cards-nav

# Verify branch created
git branch -v
```

### 2. Throughout the Week

```bash
# Make changes (CSS, templates, docs)
vim themes/danix-xyz-hacker/assets/css/main.css

# Rebuild CSS
npm run build

# Test in browser
hugo server

# Commit regularly after each component
git add .
git commit -m "feat: add article card component"

# Commit again when next component done
git add .
git commit -m "feat: add navigation header"
```

### 3. End of Week (Before Merging)

```bash
# Review all changes
git diff master..week-3-cards-nav

# Review commit history
git log master..week-3-cards-nav --oneline

# View file changes summary
git diff --stat master..week-3-cards-nav

# Test thoroughly in browser
# - All dark mode
# - All light mode
# - Mobile, tablet, desktop
# - Keyboard navigation
# - All interactive elements

# Check CSS builds without errors
npm run build

# Check for console errors in browser
# (DevTools → Console)

# Check git log looks good
git log --oneline -10
```

### 4. Merge to Master

Once testing is complete:

```bash
# Switch to master
git checkout master

# Merge feature branch
git merge week-3-cards-nav

# Optional: Delete feature branch
git branch -d week-3-cards-nav

# Verify merge
git log --oneline -5
```

### 5. Start Next Week

```bash
# Create next week's branch
git checkout -b week-4-forms-interactions

# Continue with Week 4 work...
```

---

## Branching Policy Details

### Branch Creation

- **Source:** Always branch from `master`
- **Timing:** At the start of each week
- **Naming:** `week-<N>-<description>` (lowercase, hyphens)

Examples:
```
week-3-cards-nav
week-4-forms-interactions
week-5-animations-a11y
week-6-pages-testing
```

### Commits During Week

- **Frequency:** Commit after each component is complete
- **Messages:** Clear, descriptive, following format
- **Size:** Small, logical chunks (not one big commit)

Example commits for Week 3:
```
feat: add article card component
feat: add card hover effects (lift, shadow)
feat: add navigation header
feat: add hamburger menu
feat: add breadcrumb navigation
docs: week 3 implementation complete
```

### Testing Before Merge

**Required testing:**
- [ ] Dark mode (all pages, all components)
- [ ] Light mode (toggle, verify all pages)
- [ ] Mobile responsive (320px)
- [ ] Tablet responsive (768px)
- [ ] Desktop responsive (1060px+)
- [ ] Keyboard navigation (Tab, Shift+Tab, Enter, Space, Escape)
- [ ] Focus indicators visible on all interactive elements
- [ ] No hard-coded colors in new CSS
- [ ] CSS builds with no errors (<200ms)
- [ ] No console errors in browser DevTools
- [ ] Color contrast WCAG AA verified
- [ ] All interactive components working (buttons, menus, etc.)

### Merge to Master

**Before merging:**
1. Review all changes: `git diff master..week-N-...`
2. Complete testing checklist above
3. Verify git log is clean and clear

**Merge command:**
```bash
git checkout master
git merge week-N-...
```

**After merge:**
1. Delete feature branch: `git branch -d week-N-...`
2. Verify all changes are in master: `git log --oneline -10`
3. Start next week's branch

---

## Retroactive Application

**Weeks 1-2** were completed on `master` before this policy was adopted.

**Week 3 onwards** will follow weekly branching policy.

All Week 3+ work will be properly isolated on feature branches.

---

## Commit Message Format

### Simple Format
```
<type>: <subject>
```

Example:
```
feat: add article card component
```

### Detailed Format
```
<type>: <subject>

<body>
```

Example:
```
feat: add article card component

- Image with 16:9 aspect ratio
- Title, excerpt, type badge, CTA button
- Hover: lift -2px, shadow enhancement
- Dark/light mode support
- WCAG AA accessible
```

### Types
- `feat:` — New feature (component, layout, page)
- `fix:` — Bug fix
- `style:` — CSS/styling changes
- `refactor:` — Code restructuring
- `docs:` — Documentation changes
- `chore:` — Build, tooling, config

---

## Quick Reference

### Common Commands

```bash
# Create branch
git checkout -b week-3-cards-nav

# Switch branches
git checkout master
git checkout week-3-cards-nav

# View changes
git diff master..week-3-cards-nav
git diff --stat master..week-3-cards-nav

# Commit
git add .
git commit -m "feat: add card component"

# View history
git log master..week-3-cards-nav --oneline
git log --oneline -10

# Merge
git checkout master
git merge week-3-cards-nav

# Delete branch
git branch -d week-3-cards-nav

# List branches
git branch -a
```

See `GIT-WORKFLOW-QUICK-REF.md` for more commands.

---

## FAQ

**Q: Can I work across multiple branches?**  
A: No. Work on one week's feature branch at a time. After merging to master, delete the branch and create a new one for the next week.

**Q: What if master changes while I'm working on Week 3?**  
A: Merge master into your branch: `git checkout week-3-cards-nav && git merge master`. Then resolve any conflicts.

**Q: Can I commit to master directly?**  
A: Not during the week. All changes happen on the feature branch. Merge after testing.

**Q: How long should a feature branch exist?**  
A: One week. Created at start of week, merged to master at end of week, then deleted.

**Q: What if I discover an urgent bug during Week 3?**  
A: Fix it on the feature branch (or fix it on master separately, then merge into feature branch). All work in one week's feature branch.

**Q: Can I create sub-branches off week branches?**  
A: Generally no. Keep it simple: one branch per week. If you need isolation within the week, use clear commit messages instead.

---

## Related Documentation

- **GIT-WORKFLOW.md** — Complete workflow guide with examples
- **GIT-WORKFLOW-QUICK-REF.md** — Common commands quick reference
- **WEEK3-START.md** — Week 3 quick start (includes branching instructions)

---

## Summary

**Weekly branching:**

1. ✅ Create feature branch at week start
2. ✅ Implement work, commit regularly
3. ✅ Test thoroughly before end of week
4. ✅ Review all changes
5. ✅ Merge to master when ready
6. ✅ Delete feature branch
7. ✅ Repeat for next week

This policy ensures clean code, thorough testing, and safe integration.