Skip to content

Commit 00fc5b0

Browse files
committedJan 14, 2025·
deploy: 0d5cce8
1 parent 5c42ea3 commit 00fc5b0

File tree

7 files changed

+553
-210
lines changed

7 files changed

+553
-210
lines changed
 

‎development/coding-naming-conventions/index.html

+20-19
Original file line numberDiff line numberDiff line change
@@ -283,15 +283,6 @@ <h2 id="terms" tabindex="-1"><a class="header-anchor" href="#terms">Terms</a></h
283283
<ul>
284284
<li><code>hotfix</code></li>
285285
<li><code>develop</code></li>
286-
<li><code>build</code></li>
287-
<li><code>ci</code></li>
288-
<li><code>docs</code></li>
289-
<li><code>feature</code></li>
290-
<li><code>fix</code></li>
291-
<li><code>perf</code></li>
292-
<li><code>refactor</code></li>
293-
<li><code>style</code></li>
294-
<li><code>test</code></li>
295286
</ul>
296287
</td>
297288
</tr>
@@ -330,11 +321,27 @@ <h3 id="git-repositories" tabindex="-1"><a class="header-anchor" href="#git-repo
330321
</div>
331322
<div class="md card">
332323
<h3 id="git-branches" tabindex="-1"><a class="header-anchor" href="#git-branches">Git branches</a></h3>
333-
<p>The mainline branch should be named <code class="md">main</code>. All branches should be <code class="md">kebab-case</code> with this convention:</p>
324+
<p>All branches should be <code class="md">kebab-case</code>, although change ID should be uppercase</p>
325+
<ul>
326+
<li>
327+
<p>The mainline branch should be named <code class="md">main</code>.</p>
328+
</li>
329+
<li>
330+
<p>release candidate branches should follow the convention:</p>
331+
<blockquote>
332+
<p><code class="md">develop-{version}</code><br>
333+
or<br>
334+
<code class="md">hotfix-{version}</code></p>
335+
</blockquote>
336+
</li>
337+
<li>
338+
<p>change candidate branches should follow the convention:</p>
334339
<blockquote>
335-
<p><code class="md">{type}/{change ID}-{brief description}</code></p>
340+
<p><code class="md">{change ID}-{brief description}</code></p>
336341
</blockquote>
337-
<p>A single branch should be used per change/ticket.</p>
342+
<p>Descriptions should be kept brief, not exceeding 50 characters.</p>
343+
</li>
344+
</ul>
338345
<p>See <a href="../dev-git-branching-strategy/">Git branching guidance</a> for a more detailed explanation of Git branch naming</p>
339346
</div>
340347
<div class="md card">
@@ -399,12 +406,6 @@ <h3 id="npm" tabindex="-1"><a class="header-anchor" href="#npm">NPM</a></h3>
399406
<p><code class="md">@nhsbsa/{optional service-line}-{service}-{function}-{type}</code></p>
400407
</blockquote>
401408
</div>
402-
<h2 class="nhsuk-heading-l">
403-
Related articles
404-
</h2>
405-
<ul class="nhsuk-grid-row nhsuk-card-group">
406-
</ul>
407-
408409

409410
<hr>
410411
<h2 class="nhsuk-heading-l header-anchor" id="improve-the-playbook">Improve the playbook</h2>
@@ -429,7 +430,7 @@ <h2 class="nhsuk-heading-l header-anchor" id="improve-the-playbook">Improve the
429430

430431
<div class="nhsbsa-article--date">
431432
<p class="nhsuk-body-s nhsuk-u-secondary-text-color nhsuk-u-margin-bottom-0">
432-
Published: <time datetime="2024-10-01T10:25:37.000Z">1 October 2024</time>
433+
Published: <time datetime="2024-11-18T08:12:36.000Z">18 November 2024</time>
433434
</p>
434435
<p class="nhsuk-body-s nhsuk-u-secondary-text-color nhsuk-u-margin-bottom-0">
435436
Last reviewed: <time datetime="2023-05-06T00:00:00.000Z">6 May 2023</time>

‎development/coding-peer-review/index.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,7 @@ <h2 id="8-merge-code" tabindex="-1"><a class="header-anchor" href="#8-merge-code
330330
<h2 class="nhsuk-heading-l">
331331
Related articles
332332
</h2>
333-
<ul class="nhsuk-grid-row nhsuk-card-group">
334-
</ul>
333+
<p class="nhsuk-body">No articles found.</p>
335334

336335

337336
<hr>

‎development/dev-git-branching-strategy/index.html

+11-138
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta charset="utf-8">
66
<meta http-equiv="X-UA-Compatible" content="IE=edge">
77
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
8-
<meta name="description" content="Define a branching strategy to avoid confusion and reduce risk">
8+
<meta name="description" content="A branching strategy provides structure for pushing changes through to production">
99
<meta name="robots" content="noindex">
1010

1111
<title>
@@ -42,7 +42,7 @@
4242

4343
<meta property="og:url" content="https://nhsbsa.github.io/nhsbsa-digital-playbook/development/dev-git-branching-strategy/">
4444
<meta property="og:site_name" content="nhsbsa.nhs.uk">
45-
<meta property="og:description" content="Define a branching strategy to avoid confusion and reduce risk">
45+
<meta property="og:description" content="A branching strategy provides structure for pushing changes through to production">
4646
<meta property="og:type" content="website">
4747
<meta property="og:locale" content="en_GB">
4848
<meta property="og:image" content="https://nhsbsa.github.io/nhsbsa-digital-playbook/images/opengraph-image.png?v=b6b84e727630">
@@ -114,10 +114,6 @@ <h2>NHSBSA Digital, Data and Technology Playbook</h2>
114114
<nav class="app-side-nav">
115115
<h2 class="app-side-nav__heading">Contents</h2>
116116
<div class="nhsbsa-nav__list">
117-
<ol>
118-
119-
<li><a href="#nhsbsa-branching-strategy">NHSBSA branching strategy</a>
120-
121117
<ol>
122118

123119
<li><a href="#production">Production</a>
@@ -128,23 +124,6 @@ <h2 class="app-side-nav__heading">Contents</h2>
128124

129125
<li><a href="#change-candidate">Change candidate</a>
130126
</li>
131-
</ol>
132-
</li>
133-
134-
<li><a href="#controls">Controls</a>
135-
</li>
136-
137-
<li><a href="#rebasing">Rebasing</a>
138-
139-
<ol>
140-
141-
<li><a href="#rebase-or-merge">Rebase or merge</a>
142-
</li>
143-
144-
<li><a href="#squashing">Squashing</a>
145-
</li>
146-
</ol>
147-
</li>
148127

149128
<li><a href="#workflow">Workflow</a>
150129

@@ -160,9 +139,6 @@ <h2 class="app-side-nav__heading">Contents</h2>
160139
</li>
161140
</ol>
162141
</li>
163-
164-
<li><a href="#project-documentation">Project documentation</a>
165-
</li>
166142
</ol>
167143
</div>
168144
</nav>
@@ -189,24 +165,7 @@ <h1 class="nhsuk-heading-xl">
189165
</div>
190166

191167

192-
<div class="admonition warning">
193-
<p class="admonition-title">Standard documentation</p>
194-
<p>All projects must define and publish a branching strategy in the project documentation site. See <a href="#project-documentation">project documentation</a></p>
195-
</div>
196-
<p>A Git branching strategy is a set of rules to manage and organize code changes in a Git system. A strategy helps to:</p>
197-
<ul>
198-
<li>Prevent conflicts: Avoid merge conflicts that can occur when multiple developers work on the same project at the same time</li>
199-
<li>Increase productivity: Allow multiple developers to work on different features simultaneously</li>
200-
<li>Reduce versioning management time: Help teams to manage release of code more efficiently</li>
201-
</ul>
202-
<p>There are <a href="https://graphite.dev/guides/git-branching-strategies" target="_blank" rel="noopener">many Git branching strategies</a> including:</p>
203-
<ul>
204-
<li>Git Flow</li>
205-
<li>Github Flow</li>
206-
<li>Trunk Based Development</li>
207-
</ul>
208-
<h2 id="nhsbsa-branching-strategy" tabindex="-1"><a class="header-anchor" href="#nhsbsa-branching-strategy">NHSBSA branching strategy</a></h2>
209-
<p>Our standard branching strategy is based off traditional Git Flow. It defines three types of branch:</p>
168+
<p>Our standard branching strategy is based on traditional Git-flow and defines three types of branch:</p>
210169
<ul>
211170
<li><strong>Production</strong></li>
212171
<li><strong>Release candidate</strong></li>
@@ -220,7 +179,7 @@ <h3 id="production" tabindex="-1"><a class="header-anchor" href="#production">Pr
220179
<li>The head of <code class="md">main</code> should be git tagged with a semantic version number, indicating the current version of production software.</li>
221180
</ul>
222181
<h3 id="release-candidate" tabindex="-1"><a class="header-anchor" href="#release-candidate">Release candidate</a></h3>
223-
<p>A release candidate branch will hold code intended for release into production. Quality controls such as automated acceptance tests must succeed before a release candidate is accepted for release into production.</p>
182+
<p>A release candidate branch will hold code intended for release into production. Quality controls such as automated acceptance tests must succeed before a release candidate is accepted into production.</p>
224183
<p>We use these branch names for release candidates:</p>
225184
<ul>
226185
<li><code class="md">develop</code><br>
@@ -232,90 +191,15 @@ <h3 id="release-candidate" tabindex="-1"><a class="header-anchor" href="#release
232191
<p>e.g. <code class="md">develop-wcag-2-2</code></p>
233192
<ul>
234193
<li>Changes must not be pushed directly to release candidate branches. Use branch protection to prevent developers from pushing.</li>
235-
<li>Rebased code may be force pushed by Maintainers only when aligning divergent production code (see <a href="#rebasing">rebasing</a> below). Rebasing a protected branch will require temporary rule changes.</li>
194+
<li>Rebased code may be force pushed by Maintainers only when aligning divergent production code (see <a href="../dev-git/#rebasing">rebasing</a>). Rebasing a protected branch will require temporary change of push rules.</li>
236195
</ul>
237196
<h3 id="change-candidate" tabindex="-1"><a class="header-anchor" href="#change-candidate">Change candidate</a></h3>
238197
<p>A change candidate branch is the most common type of branch, used by developers to iterate their change, before <a href="../coding-peer-review/">review</a> and merge into a release candidate branch.</p>
239-
<p>We adopt this convention for change candidate branch names:</p>
240-
<ul>
241-
<li><code class="md">build</code><br>
242-
Changes that affect the build system or external dependencies (example scopes: maven, npm).</li>
243-
<li><code class="md">ci</code><br>
244-
Changes to our CI configuration files and scripts (example scopes: Gitlab-CI, Azure Devops)</li>
245-
<li><code class="md">docs</code><br>
246-
Documentation only changes</li>
247-
<li><code class="md">feature</code><br>
248-
A new feature</li>
249-
<li><code class="md">fix</code><br>
250-
A bug fix</li>
251-
<li><code class="md">perf</code><br>
252-
A code change that improves performance</li>
253-
<li><code class="md">refactor</code><br>
254-
A code change that neither fixes a bug nor adds a feature</li>
255-
<li><code class="md">style</code><br>
256-
Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)</li>
257-
<li><code class="md">test</code><br>
258-
Adding missing tests or correcting existing tests</li>
259-
</ul>
260-
<p>Branch names must follow our <a href="../coding-naming-conventions/">naming conventions</a> to include change ID and description. e.g. <code class="md">feature/LIS-1234-add-back-button</code></p>
261-
<h2 id="controls" tabindex="-1"><a class="header-anchor" href="#controls">Controls</a></h2>
262-
<p>Git repository hosting providers provide various features to add additional controls on what can be done. These must be configured to protect the branch and release process.</p>
263-
<ul>
264-
<li>Prevent unauthorised push to production and release branches</li>
265-
<li>Prevent unapproved merge of code into the release process</li>
266-
<li>Prevent non-compliant commits and branch names</li>
267-
</ul>
268-
<details class="nhsuk-details"><summary class="nhsuk-details__summary"><span class="nhsuk-details__summary-text">Gitlab configuration</span></summary>
269-
<div class="nhsuk-details__text">
270-
<ul>
271-
<li>Under <code class="md">Settings</code> &gt; <code class="md">Repository</code> &gt; <code class="md">Protected branches</code>:
272-
<ul>
273-
<li>Protect named <code class="md">main</code> branch, and wildcard <code class="md">develop*</code> and <code class="md">hotfix*</code></li>
274-
<li>Allowed to merge: <code class="md">Developers</code> and <code class="md">Maintainers</code></li>
275-
<li>Allowed to push and merge: <code class="md">No-one</code></li>
276-
<li>Allowed to force push: <code class="md">No</code></li>
277-
</ul>
278-
</li>
279-
<li>Under <code class="md">Settings</code> &gt; <code class="md">Repository</code> &gt; <code class="md">Branch rules</code>:
280-
<ul>
281-
<li>Add rule for <code class="md">All protected branches</code></li>
282-
<li>Add approval rule</li>
283-
<li>Required approvals at <code class="md">1</code> as a minimum. Projects may choose more approvers.</li>
284-
</ul>
285-
</li>
286-
<li>Under <code class="md">Settings</code> &gt; <code class="md">Merge requests</code>
287-
<ul>
288-
<li>Merge method: <code class="md">Fast-forward merge</code></li>
289-
</ul>
290-
</li>
291-
<li>Under <code class="md">Settings</code> &gt; <code class="md">Push rules</code> &gt; <code class="md">Branch name</code>
198+
<p>Change candidate branch names follow our <a href="../coding-naming-conventions/">naming conventions</a> to include change ID and description:</p>
292199
<ul>
293-
<li>Branch name regex: <code class="md">(main|develop|hotfix)|(build|ci|docs|feature|fix|perf|refactor|style|test)[\-\/]([A-Z]{3,4}|NO-JIRA)</code></li>
294-
</ul>
295-
</li>
200+
<li><code class="md">{change ID}-{brief description}</code></li>
296201
</ul>
297-
</div></details>
298-
<h2 id="rebasing" tabindex="-1"><a class="header-anchor" href="#rebasing">Rebasing</a></h2>
299-
<p>Rebasing is a way to tidy up the Git commit history. It involves rewriting commits in various ways:</p>
300-
<ul>
301-
<li>Fixing merge conflicts: Rebasing can alter changes in a branch to avoid conflict with changes in another branch.</li>
302-
<li>Cleaning up project history: Rebasing can create a cleaner project history by combining multiple commits into one.</li>
303-
<li>Editing commit messages: Rebasing can be used to edit previous commit messages.</li>
304-
<li>Deleting or reverting commits: Rebasing can be used to delete or revert commits that are no longer necessary</li>
305-
</ul>
306-
<div class="admonition warning">
307-
<p class="admonition-title">Proceed with caution</p>
308-
<p>Rebasing will change the Git commit graph and has potential to create an inconsistent repository that is difficult to recover from. Rebase with caution and consult your professional lead if you are unsure of what you are doing.</p>
309-
<p>Whenever a shared branch is rebased, the entire team needs to be notified. Every team member will need to reset their local branch to the rewritten remote:</p>
310-
<p>e.g.</p>
311-
<pre class="language-bash"><code class="language-bash"><span class="token function">git</span> fetch <span class="token parameter variable">--all</span>
312-
<span class="token function">git</span> reset <span class="token parameter variable">--hard</span> <span class="token operator">&lt;</span>branch<span class="token operator">></span> origin/<span class="token operator">&lt;</span>branch<span class="token operator">></span></code></pre>
313-
</div>
314-
<h3 id="rebase-or-merge" tabindex="-1"><a class="header-anchor" href="#rebase-or-merge">Rebase or merge</a></h3>
315-
<p>We recommend that project teams rebase their branches against the upstream branch whenever they diverge. This provides a more streamlined and understandable git history, and simplifies squashing.</p>
316-
<p>Merging from an upstream branch on the other hand makes squashing and reverting change more difficult.</p>
317-
<h3 id="squashing" tabindex="-1"><a class="header-anchor" href="#squashing">Squashing</a></h3>
318-
<p>We recommend that developers squash commits into logical commits for change candidate branches prior to merge into a release candidate branch. This removes unneccesary commits that can confuse and provides a clean and logical git history.</p>
202+
<p>e.g. <code class="md">LIS-1234-add-back-button</code></p>
319203
<h2 id="workflow" tabindex="-1"><a class="header-anchor" href="#workflow">Workflow</a></h2>
320204
<h3 id="preconditions" tabindex="-1"><a class="header-anchor" href="#preconditions">Preconditions</a></h3>
321205
<ul>
@@ -326,7 +210,6 @@ <h3 id="preconditions" tabindex="-1"><a class="header-anchor" href="#preconditio
326210
<li>must import into an empty repository in the Git hosting provider. Merging a repository into a pre-existing <code class="md">main</code> will cause confusion in the git history</li>
327211
</ul>
328212
</li>
329-
<li><a href="#controls">Controls</a> must be applied as above</li>
330213
</ul>
331214
<h3 id="release-candidate-1" tabindex="-1"><a class="header-anchor" href="#release-candidate-1">Release Candidate</a></h3>
332215
<ul>
@@ -342,18 +225,8 @@ <h3 id="change-candidate-1" tabindex="-1"><a class="header-anchor" href="#change
342225
<ul>
343226
<li>Developer creates a new change candidate branch, <code class="md">feature-xyz</code> branch from the newly created <code class="md">develop-xyz</code> branch</li>
344227
<li>When the feature changes are complete they raise a merge request for <a href="../coding-peer-review/">review</a></li>
345-
<li>The changes are merged (ideally <a href="#squashing">commits squashed</a>) in to the <code class="md">develop</code> branch. The change candidate branch should be deleted</li>
346-
<li>The <em>change</em> -&gt; <em>release</em> cycle is repeated until all the changes relating the release are stable and tested</li>
347-
</ul>
348-
<h2 id="project-documentation" tabindex="-1"><a class="header-anchor" href="#project-documentation">Project documentation</a></h2>
349-
<p>All projects must document their git branching and release strategy. Deviation from standards must also be documented along with decision records explaining the reason for deviation.</p>
350-
<p>Documentation should define:</p>
351-
<ul>
352-
<li>Root git branching strategy. e.g. nhsbsa, git-flow, github-flow, trunk-based-development, other</li>
353-
<li>Branch naming convention</li>
354-
<li>Rebasing approach including rebase vs merge commits, and squashing</li>
355-
<li>Branch protection</li>
356-
<li>Approval rules</li>
228+
<li>The changes are merged (ideally <a href="../dev-git/#squashing">commits squashed</a>) in to the <code class="md">develop</code> branch. The change candidate branch should be deleted</li>
229+
<li>The <em>change</em> -&gt; <em>release</em> cycle is repeated until all the changes relating to the release are stable and tested</li>
357230
</ul>
358231

359232
<hr>
@@ -379,7 +252,7 @@ <h2 class="nhsuk-heading-l header-anchor" id="improve-the-playbook">Improve the
379252

380253
<div class="nhsbsa-article--date">
381254
<p class="nhsuk-body-s nhsuk-u-secondary-text-color nhsuk-u-margin-bottom-0">
382-
Published: <time datetime="2024-10-01T06:53:54.000Z">1 October 2024</time>
255+
Published: <time datetime="2024-11-18T08:12:36.000Z">18 November 2024</time>
383256
</p>
384257
<p class="nhsuk-body-s nhsuk-u-secondary-text-color nhsuk-u-margin-bottom-0">
385258
Last reviewed: <time datetime="2024-09-20T00:00:00.000Z">20 September 2024</time>

‎development/dev-git/index.html

+452
Large diffs are not rendered by default.

‎development/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ <h2 class="nhsuk-card__heading nhsuk-heading-m">
238238

239239
</div>
240240
<p class="nhsuk-card__description">Naming things well from the start can avoid a lot of confusion as a project matures</p>
241-
<time class="nhsuk-body-s nhsuk-u-secondary-text-color nhsuk-u-margin-top-5 nhsuk-u-margin-bottom-0" datetime="2024-10-01T10:25:37.000Z">1 October 2024</time>
241+
<time class="nhsuk-body-s nhsuk-u-secondary-text-color nhsuk-u-margin-top-5 nhsuk-u-margin-bottom-0" datetime="2024-11-18T08:12:36.000Z">18 November 2024</time>
242242
</div>
243243
</div>
244244
</li>

‎drafts/index.html

+20-2
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,26 @@ <h2 class="nhsuk-card__heading nhsuk-heading-m">
200200

201201

202202
</div>
203-
<p class="nhsuk-card__description">Define a branching strategy to avoid confusion and reduce risk</p>
204-
<time class="nhsuk-body-s nhsuk-u-secondary-text-color nhsuk-u-margin-top-5 nhsuk-u-margin-bottom-0" datetime="2024-10-01T06:53:54.000Z">1 October 2024</time>
203+
<p class="nhsuk-card__description">A branching strategy provides structure for pushing changes through to production</p>
204+
<time class="nhsuk-body-s nhsuk-u-secondary-text-color nhsuk-u-margin-top-5 nhsuk-u-margin-bottom-0" datetime="2024-11-18T08:12:36.000Z">18 November 2024</time>
205+
</div>
206+
</div>
207+
</li>
208+
<li class="nhsuk-grid-column-one-third nhsuk-card-group__item">
209+
<div class="nhsuk-card nhsuk-card--clickable">
210+
<div class="nhsuk-card__content">
211+
<div class="nhsuk-card__header">
212+
<h2 class="nhsuk-card__heading nhsuk-heading-m">
213+
<a class="nhsuk-card__link" href="/nhsbsa-digital-playbook/development/dev-git/">Git</a>
214+
</h2>
215+
<strong class="nhsuk-tag nhsuk-tag--grey">
216+
DRAFT
217+
</strong>
218+
219+
220+
</div>
221+
<p class="nhsuk-card__description">Define how your team use Git to avoid confusion and reduce risk</p>
222+
<time class="nhsuk-body-s nhsuk-u-secondary-text-color nhsuk-u-margin-top-5 nhsuk-u-margin-bottom-0" datetime="2024-11-18T08:12:36.000Z">18 November 2024</time>
205223
</div>
206224
</div>
207225
</li>

‎review/index.html

+48-48
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.