Vijay_Wiki
/ Computing and IT for engineers / Versioning code

Versioning and Cataloguing Engineering Code: Header Blocks, Semantic Versions and Git

K Vijay Anand · Vijay_Wiki quick-reference article · 24 November 2026
GitVersion controlSemantic versioningDocumentation

Engineers accumulate scripts and small tools quickly: data converters, calculators, rig controllers, report generators. Without discipline, copies multiply on laptops and pen drives, and nobody knows which is current. A small set of habits fixes this: a header block in every file, semantic version numbers, git history, a predictable folder layout, and a catalogue generated from the headers.

Key takeaways

  • Put a header block at the top of every file: tool name, family, version, date, origin and a changes line.
  • Semantic versioning MAJOR.MINOR.PATCH: breaking change → MAJOR, new feature → MINOR, fix → PATCH.
  • Git gives history and safe experiments: commit small logical changes with clear messages; tag releases.
  • Group tools into family repositories under one portable root and use relative links so the root can move between drives.
  • Generate a catalogue (index page) by scanning headers, and keep three copies on two media types, one off-site (3-2-1).
<!DOCTYPE html>
<!--
TOOL:    Spring Rate Calculator
FAMILY:  spring-tools
VERSION: 2.3.1
DATE:    2026-11-24
CHAT:    origin / discussion reference
CHANGES: 2.3.1 Fixed unit conversion for N/mm to lbf/in
STATUS:  Released
-->

In Python, use a module docstring or comment block with the same fields and keep __version__ in step with VERSION. A catalogue script can then read every file's header without running it.

2. Semantic versioning

ChangeBumpExample
Breaking change: inputs, outputs or file format no longer compatibleMAJOR1.4.2 → 2.0.0
New feature, backward compatibleMINOR1.4.2 → 1.5.0
Bug fix, no new featurePATCH1.4.2 → 1.4.3
Pre-releasesuffix2.0.0-rc.1

3. A minimal git routine

git init                              # once per repository
git add spring_calc.html
git commit -m "spring-tools 2.3.1: fix N/mm to lbf/in conversion"
git tag v2.3.1                         # mark a release
git log --oneline --graph              # history
git switch -c try-new-layout           # experiment safely on a branch
git switch main && git merge try-new-layout
git push origin main --tags            # if a remote (e.g. GitHub, private) is used
Good practiceWhy
One logical change per commitEasy to review and undo
Message: what and why, with versionHistory reads like a change log
.gitignore for outputs, data, secretsKeeps repos small and safe
Tags for releasesExact version can be rebuilt
Private remote or second diskBackup and access from other machines

4. Layout and catalogue

Portable roote.g. CODE_BASEFamily reposspring-tools, vib-tools…Each toolheader + versionCatalogue scriptscan headersindex.htmlrelative links
Figure 1. A portable code base: one root, family repositories, and a generated index with relative links.

5. Calculators

Version bump and header block generator

6. Self-test: check your understanding

Pick an answer to see the explanation. Numerical answers are accepted within the stated tolerance (±3 % unless noted).

Score

7. References and further reading

  1. Preston-Werner, T., Semantic Versioning 2.0.0, semver.org.
  2. Chacon, S. and Straub, B., Pro Git, 2nd ed., Apress, 2014 (free online).
  3. Wilson, G. et al., 'Good enough practices in scientific computing', PLOS Computational Biology, 13(6), 2017.

Web pages

Disclaimer

This article is for education and quick reference. Formulas are simplified first estimates and examples use typical data. For design, safety and maintenance decisions use manufacturers' data and the applicable standards.

Related Vijay_Wiki articles