-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit-workflow.html
More file actions
1126 lines (1008 loc) · 43.8 KB
/
git-workflow.html
File metadata and controls
1126 lines (1008 loc) · 43.8 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
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Git Workflow - React Template</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap"
rel="stylesheet"
/>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family:
"Inter",
-apple-system,
BlinkMacSystemFont,
sans-serif;
background: #fafafa;
padding: 48px 24px;
color: #1a1a1a;
line-height: 1.6;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.container {
max-width: 920px;
margin: 0 auto;
background: white;
border-radius: 8px;
box-shadow:
0 1px 3px rgba(0, 0, 0, 0.06),
0 1px 2px rgba(0, 0, 0, 0.08);
padding: 64px 72px;
}
.header {
border-bottom: 1px solid #e8e8e8;
padding-bottom: 32px;
margin-bottom: 48px;
}
.header h1 {
font-size: 32px;
font-weight: 600;
color: #1a1a1a;
letter-spacing: -0.02em;
margin-bottom: 12px;
}
.header .subtitle {
font-size: 16px;
color: #6b6b6b;
font-weight: 400;
letter-spacing: -0.01em;
margin-bottom: 16px;
}
.repo-link {
display: inline-flex;
align-items: center;
gap: 8px;
font-size: 14px;
color: #5a5a5a;
text-decoration: none;
padding: 8px 14px;
background: #f5f5f5;
border-radius: 4px;
font-family: "JetBrains Mono", monospace;
transition: background 0.15s ease;
}
.repo-link:hover {
background: #e8e8e8;
}
.section {
margin-bottom: 56px;
}
.section:last-child {
margin-bottom: 0;
}
.section-title {
font-size: 20px;
font-weight: 600;
color: #1a1a1a;
margin-bottom: 24px;
letter-spacing: -0.02em;
}
.section-intro {
font-size: 15px;
color: #5a5a5a;
line-height: 1.6;
margin-bottom: 28px;
}
.branch-diagram {
background: #fafafa;
border: 1px solid #f0f0f0;
border-radius: 6px;
padding: 32px;
margin: 24px 0;
}
.branch-row {
display: flex;
align-items: center;
margin-bottom: 20px;
}
.branch-row:last-child {
margin-bottom: 0;
}
.branch-name {
font-family: "JetBrains Mono", monospace;
font-size: 14px;
color: #1a1a1a;
background: white;
padding: 8px 16px;
border-radius: 4px;
border: 1px solid #e0e0e0;
min-width: 140px;
}
.branch-arrow {
color: #d0d0d0;
margin: 0 16px;
font-size: 18px;
}
.branch-description {
font-size: 14px;
color: #6b6b6b;
line-height: 1.5;
}
.workflow-step {
margin-bottom: 32px;
padding-bottom: 32px;
border-bottom: 1px solid #f5f5f5;
}
.workflow-step:last-child {
border-bottom: none;
margin-bottom: 0;
padding-bottom: 0;
}
.step-header {
display: flex;
align-items: baseline;
gap: 12px;
margin-bottom: 12px;
}
.step-number {
font-size: 14px;
font-weight: 600;
color: #a0a0a0;
min-width: 32px;
}
.step-title {
font-size: 17px;
font-weight: 600;
color: #1a1a1a;
letter-spacing: -0.01em;
}
.step-description {
font-size: 15px;
color: #5a5a5a;
line-height: 1.6;
margin-bottom: 16px;
margin-left: 44px;
}
.code-block {
background: #2d2d2d;
color: #e8e8e8;
padding: 20px;
border-radius: 6px;
margin: 16px 0;
margin-left: 44px;
font-family: "JetBrains Mono", monospace;
font-size: 13px;
line-height: 1.6;
overflow-x: auto;
}
.code-block .comment {
color: #8a8a8a;
}
.code-block .command {
color: #a8d5ff;
}
.code-block .string {
color: #c3e88d;
}
.code-block .variable {
color: #ffcb6b;
}
.inline-code {
font-family: "JetBrains Mono", monospace;
font-size: 13px;
background: #f5f5f5;
padding: 2px 6px;
border-radius: 3px;
color: #4a4a4a;
}
.info-box {
background: #f9f9f9;
border-left: 3px solid #e0e0e0;
padding: 16px 20px;
margin: 16px 0;
margin-left: 44px;
border-radius: 0 4px 4px 0;
}
.info-box-title {
font-size: 14px;
font-weight: 600;
color: #1a1a1a;
margin-bottom: 8px;
}
.info-box-content {
font-size: 14px;
color: #5a5a5a;
line-height: 1.5;
}
.convention-list {
list-style: none;
margin-left: 44px;
margin-top: 16px;
}
.convention-list li {
padding: 10px 0;
font-size: 14px;
color: #5a5a5a;
line-height: 1.5;
padding-left: 24px;
position: relative;
}
.convention-list li::before {
content: "";
position: absolute;
left: 0;
top: 16px;
width: 6px;
height: 6px;
background: #d0d0d0;
border-radius: 50%;
}
.example-section {
background: #fafafa;
border: 1px solid #f0f0f0;
border-radius: 6px;
padding: 24px;
margin: 24px 0;
}
.example-title {
font-size: 15px;
font-weight: 600;
color: #1a1a1a;
margin-bottom: 16px;
}
.example-scenario {
font-size: 14px;
color: #6b6b6b;
line-height: 1.6;
margin-bottom: 16px;
}
.dos-donts {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
margin-top: 24px;
}
.do-card,
.dont-card {
padding: 20px;
border-radius: 6px;
}
.do-card {
background: #f0f9f4;
border: 1px solid #d4edda;
}
.dont-card {
background: #fef5f5;
border: 1px solid #f5d4d4;
}
.card-title {
font-size: 13px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
margin-bottom: 12px;
}
.do-card .card-title {
color: #2d7a4f;
}
.dont-card .card-title {
color: #a73636;
}
.card-example {
font-family: "JetBrains Mono", monospace;
font-size: 13px;
color: #4a4a4a;
line-height: 1.6;
}
.reference-section {
margin-top: 48px;
padding-top: 32px;
border-top: 1px solid #e8e8e8;
}
.reference-link {
display: inline-block;
font-size: 14px;
color: #5a5a5a;
text-decoration: none;
padding: 8px 16px;
border: 1px solid #e0e0e0;
border-radius: 4px;
margin-right: 12px;
margin-bottom: 12px;
transition: all 0.15s ease;
}
.reference-link:hover {
background: #fafafa;
border-color: #d0d0d0;
}
.doc-reference {
font-size: 12px;
color: #a0a0a0;
margin-top: 8px;
font-style: italic;
}
@media (max-width: 768px) {
.container {
padding: 40px 32px;
}
.dos-donts {
grid-template-columns: 1fr;
}
.branch-row {
flex-direction: column;
align-items: flex-start;
gap: 8px;
}
.branch-arrow {
transform: rotate(90deg);
margin: 8px 0;
}
.code-block,
.info-box,
.step-description,
.convention-list {
margin-left: 0;
}
}
@media print {
body {
background: white;
padding: 0;
}
.container {
box-shadow: none;
padding: 32px;
}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>Git Workflow : React Development (as an example)</h1>
<p class="subtitle">
A practical guide for working with the Orcta React template
</p>
<a
href="https://github.com/Orctatech-Engineering-Team/orcta-react-template"
class="repo-link"
>
<span>→</span>
<span>Orctatech-Engineering-Team/orcta-react-template</span>
</a>
</div>
<div class="section">
<h2 class="section-title">Branching Model</h2>
<p class="section-intro">
We follow a simplified Git Flow that prioritizes clarity and
reduces merge conflicts. All feature work happens in
isolated branches that merge back to development.
</p>
<div class="branch-diagram">
<div class="branch-row">
<div class="branch-name">main</div>
<span class="branch-arrow">→</span>
<div class="branch-description">
Production-ready code. Protected branch. Only tech
leads can merge.
</div>
</div>
<div class="branch-row">
<div class="branch-name">dev</div>
<span class="branch-arrow">→</span>
<div class="branch-description">
Integration branch. All features merge here first
for testing.
</div>
</div>
<div class="branch-row">
<div class="branch-name">feature/*</div>
<span class="branch-arrow">→</span>
<div class="branch-description">
Individual feature branches. Created from dev,
merged back to dev.
</div>
</div>
<div class="branch-row">
<div class="branch-name">hotfix/*</div>
<span class="branch-arrow">→</span>
<div class="branch-description">
Emergency fixes. Created from main, merged to both
main and dev.
</div>
</div>
</div>
<div class="doc-reference">
Engineering Playbook, Section 4.2
</div>
</div>
<div class="section">
<h2 class="section-title">Complete Workflow</h2>
<div class="workflow-step">
<div class="step-header">
<span class="step-number">Step 1</span>
<h3 class="step-title">Clone and Setup</h3>
</div>
<p class="step-description">
Start by creating your project from the React template
on GitHub. Go to the template repository, select
<strong>“Use this template”</strong>, create your new
repository, then clone it to your machine.
</p>
<div class="code-block">
<span class="comment"
># After creating your repo from the template</span
><br />
<span class="comment"
># Clone the newly generated repository</span
><br />
<span class="command">git clone</span>
git@github.com:Orctatech-Engineering-Team/YOUR-NEW-REPO.git<br />
<span class="command">cd</span>
YOUR-NEW-REPO<br />
<span class="comment"># Install dependencies</span
><br />
<span class="command">pnpm install</span><br />
<span class="comment"># Verify the setup</span><br />
<span class="command">pnpm run dev</span><br />
<span class="command">pnpm test</span><br />
</div>
<div class="info-box">
<div class="info-box-title">First Time Setup</div>
<div class="info-box-content">
Ensure you have Node.js 20+ and pnpm 10+ installed.
The template includes pre-configured ESLint,
Prettier, and TypeScript settings. Run the linter
with <span class="inline-code">npm run lint</span>
before committing.
</div>
</div>
</div>
<div class="workflow-step">
<div class="step-header">
<span class="step-number">Step 2</span>
<h3 class="step-title">Create a Feature Branch</h3>
</div>
<p class="step-description">
Always create a new branch from the latest dev branch.
Never work directly on main or dev.
</p>
<div class="code-block">
<span class="comment"
># Switch to dev and get latest changes</span
><br />
<span class="command">git checkout</span> dev<br />
<span class="command">git pull</span> origin dev<br />
<span class="comment"># Create your feature branch</span
><br />
<span class="command">git checkout -b</span>
<span class="string">feature/user-authentication</span>
</div>
<div class="info-box">
<div class="info-box-title">
Branch Naming Convention
</div>
<div class="info-box-content">
Use descriptive kebab-case names:
<span class="inline-code"
>feature/user-profile-page</span
>,
<span class="inline-code"
>feature/payment-integration</span
>,
<span class="inline-code"
>hotfix/login-redirect-bug</span
>
</div>
</div>
</div>
<div class="workflow-step">
<div class="step-header">
<span class="step-number">Step 3</span>
<h3 class="step-title">Develop Your Feature</h3>
</div>
<p class="step-description">
Build your feature following React best practices and
the template's folder structure.
</p>
<div class="code-block">
<span class="comment"
># Example: Adding a new component</span
><br />
src/ components/ user-profile/ user-profile.tsx
user-profile.test.tsx user-profile.module.css
</div>
<ul class="convention-list">
<li>
Component names use PascalCase but their file names
are kebab-case:
<span class="inline-code">user-profile.tsx</span>
</li>
<li>
Component folders use kebab-case:
<span class="inline-code">user-profile/</span>
</li>
<li>
Test files match component names:
<span class="inline-code"
>user-profile.test.tsx</span
>
</li>
<li>
CSS modules use kebab-case:
<span class="inline-code"
>user-profile.module.css</span
>
</li>
</ul>
<div class="doc-reference">
Naming Conventions Guide, Section 2.4
</div>
</div>
<div class="workflow-step">
<div class="step-header">
<span class="step-number">Step 4</span>
<h3 class="step-title">Commit Your Changes</h3>
</div>
<p class="step-description">
Make atomic commits with clear, descriptive messages in
imperative mood.
</p>
<div class="code-block">
<span class="comment"># Stage your changes</span><br />
<span class="command">git add</span>
src/components/user-profile/<br />
<span class="comment"
># Commit with descriptive message</span
><br />
<span class="command">git commit -m</span>
<span class="string"
>"Add user profile component with avatar
display"</span
>
</div>
<div class="dos-donts">
<div class="do-card">
<div class="card-title">Good Commits</div>
<div class="card-example">
Add user authentication form<br /><br />
Fix navigation menu overflow on mobile<br /><br />
Update API endpoint for user profiles<br /><br />
Refactor payment form validation logic
</div>
</div>
<div class="dont-card">
<div class="card-title">Bad Commits</div>
<div class="card-example">
Fixed stuff<br /><br />
Update<br /><br />
WIP<br /><br />
asdfasdf<br /><br />
Added feature and fixed bug and updated docs
</div>
</div>
</div>
<div class="doc-reference">
Engineering Playbook, Section 4.1
</div>
</div>
<div class="workflow-step">
<div class="step-header">
<span class="step-number">Step 5</span>
<h3 class="step-title">Keep Your Branch Updated</h3>
</div>
<p class="step-description">
Regularly sync your feature branch with dev to minimize
merge conflicts.
</p>
<div class="code-block">
<span class="comment"
># Fetch latest changes from dev</span
><br />
<span class="command">git fetch</span> origin dev<br />
<span class="comment"
># Rebase your feature branch on top of dev</span
><br />
<span class="command">git rebase</span> origin/dev<br />
<span class="comment"
># If conflicts occur, resolve them and
continue</span
><br />
<span class="comment"
># Edit conflicted files, then:</span
><br />
<span class="command">git add</span> .<br />
<span class="command">git rebase --continue</span><br />
</div>
<div class="info-box">
<div class="info-box-title">Rebase vs Merge</div>
<div class="info-box-content">
We prefer rebasing feature branches to maintain a
linear history. This keeps the commit log clean and
makes it easier to understand the evolution of the
codebase. Only merge when integrating into dev or
main.
</div>
</div>
</div>
<div class="workflow-step">
<div class="step-header">
<span class="step-number">Step 6</span>
<h3 class="step-title">Run Tests and Linting</h3>
</div>
<p class="step-description">
Ensure all tests pass and code meets quality standards
before pushing.
</p>
<div class="code-block">
<span class="comment"># Run tests</span><br />
<span class="command">pnpm test</span><br />
<span class="comment"># Run linter</span><br />
<span class="command">pnpm run lint</span><br />
<span class="comment"
># Fix auto-fixable linting issues</span
><br />
<span class="command">pnpm run lint:fix</span><br />
<span class="comment"># Check TypeScript types</span
><br />
<span class="command">pnpm run type-check</span><br />
<span class="comment"># Build to verify no errors</span
><br />
<span class="command">pnpm run build</span><br />
</div>
<div class="info-box">
<div class="info-box-title">Pre-commit Hooks</div>
<div class="info-box-content">
The template includes Husky pre-commit hooks that
automatically run linting and tests. If these checks
fail, the commit will be blocked. Fix the issues
before committing.
</div>
</div>
</div>
<div class="workflow-step">
<div class="step-header">
<span class="step-number">Step 7</span>
<h3 class="step-title">Push Your Branch</h3>
</div>
<p class="step-description">
Push your feature branch to the remote repository.
</p>
<div class="code-block">
<span class="comment"
># Push your branch for the first time</span
><br />
<span class="command">git push -u</span> origin
<span class="string">feature/user-authentication</span
><br />
<span class="comment"
># Subsequent pushes (after first push)</span
><br />
<span class="command">git push</span><br />
<span class="comment"
># Force push after rebasing (use with
caution)</span
><br />
<span class="command">git push --force-with-lease</span
><br />
</div>
<div class="info-box">
<div class="info-box-title">Force Pushing</div>
<div class="info-box-content">
Use
<span class="inline-code">--force-with-lease</span>
instead of
<span class="inline-code">--force</span> when you
need to force push after rebasing. This prevents
accidentally overwriting someone else's work if
they've pushed to your branch.
</div>
</div>
</div>
<div class="workflow-step">
<div class="step-header">
<span class="step-number">Step 8</span>
<h3 class="step-title">Create a Pull Request</h3>
</div>
<p class="step-description">
Open a pull request from your feature branch to dev. Use
the PR template.
</p>
<div class="code-block">
<span class="comment"
># Via GitHub CLI (if installed)</span
><br />
<span class="command">gh pr create</span> --base dev
--title
<span class="string">"Add user authentication"</span
><br />
<span class="comment"
># Or visit GitHub and create PR manually</span
><br />
<span class="comment"
># The PR template will auto-populate</span
><br />
</div>
<ul class="convention-list">
<li>
Base branch should always be
<span class="inline-code">dev</span> (not main)
</li>
<li>Fill out all sections of the PR template</li>
<li>Link to related issues or tickets</li>
<li>Add screenshots for UI changes</li>
<li>Request review from at least one team member</li>
<li>
Add appropriate labels: feature, bug fix, refactor,
etc.
</li>
</ul>
<div class="doc-reference">
Engineering Playbook, Section 4.3
</div>
</div>
<div class="workflow-step">
<div class="step-header">
<span class="step-number">Step 9</span>
<h3 class="step-title">Address Review Feedback</h3>
</div>
<p class="step-description">
Respond to reviewer comments and make requested changes.
</p>
<div class="code-block">
<span class="comment"
># Make changes based on feedback</span
><br />
<span class="comment"># Edit files, then commit</span
><br />
<span class="command">git add</span> .<br />
<span class="command">git commit -m</span>
<span class="string"
>"Address review feedback: improve error
handling"</span
><br />
<span class="comment"># Push changes</span><br />
<span class="command">git push</span><br />
<span class="comment"
># PR will automatically update</span
><br />
</div>
<div class="info-box">
<div class="info-box-title">Review Etiquette</div>
<div class="info-box-content">
Respond to all comments, even if just to
acknowledge. If you disagree with a suggestion,
explain your reasoning respectfully. Mark
conversations as resolved once addressed. Reviewers
should respond within 48 hours.
</div>
</div>
<div class="doc-reference">
Engineering Playbook, Section 5.3
</div>
</div>
<div class="workflow-step">
<div class="step-header">
<span class="step-number">Step 10</span>
<h3 class="step-title">Merge and Clean Up</h3>
</div>
<p class="step-description">
Once approved, merge your PR and delete the feature
branch.
</p>
<div class="code-block">
<span class="comment"
># After PR is approved and CI passes</span
><br />
<span class="comment"
># Merge via GitHub UI (squash commits)</span
><br />
<span class="comment"
># Then locally, clean up your branch</span
><br />
<span class="command">git checkout</span> dev<br />
<span class="command">git pull</span> origin dev<br />
<span class="comment"
># Delete local feature branch</span
><br />
<span class="command">git branch -d</span><br />
<span class="string">feature/user-authentication</span
><br />
<span class="comment"
># Delete remote branch (usually auto-deleted by
GitHub)</span
><br />
<span class="command">git push</span> origin --delete
<span class="string">feature/user-authentication</span>
</div>
<div class="info-box">
<div class="info-box-title">Merge Strategy</div>
<div class="info-box-content">
We use squash merging to keep the dev and main
branches clean. All commits from your feature branch
are combined into a single commit. Write a clear
merge commit message that summarizes the entire
feature.
</div>
</div>
<div class="doc-reference">
Engineering Playbook, Section 4.3
</div>
</div>
</div>
<div class="section">
<h2 class="section-title">Common Scenarios</h2>
<div class="example-section">
<div class="example-title">
Scenario: Working on Multiple Features
</div>
<div class="example-scenario">
You're working on a user profile feature, but need to
start a hotfix for a critical bug.
</div>
<div class="code-block">
<span class="comment"># Commit your current work</span
><br />
<span class="command">git add</span> .<br />
<span class="command">git commit -m</span>
<span class="string">"WIP: user profile layout"</span
><br />
<span class="comment"># Switch to main for hotfix</span
><br />
<span class="command">git checkout</span> main<br />
<span class="command">git pull</span> origin main<br />
<span class="command">git checkout -b</span>
<span class="string">hotfix/login-redirect</span><br />
<span class="comment"
># Fix bug, commit, and create PR</span
><br />
<span class="comment"
># After hotfix is merged, return to feature</span
><br />
<span class="command">git checkout</span>
<span class="string">feature/user-profile</span>
</div>
</div>
<div class="example-section">
<div class="example-title">
Scenario: Merge Conflict During Rebase
</div>
<div class="example-scenario">
You're rebasing your feature branch and encounter
conflicts.
</div>
<div class="code-block">
<span class="command">git rebase</span> origin/dev
<span class="comment"
># Git shows conflicts in specific files</span
><br />
<span class="comment"
># Open conflicted files and look for markers:</span
><br />
<span class="comment"># <<<<<<< HEAD</span>
<span class="comment"># Your changes</span>
<span class="comment"># =======</span>
<span class="comment"># Their changes</span>
<span class="comment"># >>>>>>></span>
<span class="comment"
># Edit files to resolve conflicts</span
><br />
<span class="comment"># Remove conflict markers</span
><br />
<span class="comment"># Keep the correct code</span
><br />
<span class="command">git add</span> .
<span class="command">git rebase --continue</span>