🔀 Git & GitHub Intermediate

What is semantic versioning (SemVer) and how does it relate to Git tags?

Why Interviewers Ask This

This question targets practical, hands-on experience with Git & GitHub. Interviewers want to see if you've worked with these concepts in real projects, not just read about them. Strong answers include concrete examples.

Answer

Semantic versioning (SemVer) is a versioning convention that encodes meaning into the version number: MAJOR.MINOR.PATCH (e.g., 2.4.1). Rules: increment MAJOR (2→3) for breaking changes — incompatible API changes; increment MINOR (2.4→2.5) for new backward-compatible features; increment PATCH (2.4.1→2.4.2) for backward-compatible bug fixes. Pre-release: 2.5.0-alpha.1, 2.5.0-rc.1. Build metadata: 2.5.0+build.123. Git tags are the mechanism for marking specific commits as version releases: git tag -a v2.4.1 -m "Release 2.4.1 - Fix login timeout"; git push origin v2.4.1. GitHub creates release packages from tags. Automation: semantic-release npm package analyzes Conventional Commit messages and automatically: determines the next version number; creates the Git tag; generates a changelog; publishes to npm. Integration: CI/CD pipelines trigger on tag creation (on: push: tags: ["v*"] in GitHub Actions) to automatically build and deploy. Consumers use ~ (patch updates) and ^ (minor updates) in package.json, trusting SemVer semantics for safe upgrades.

Pro Tip

Demonstrate both theoretical understanding and practical experience. Say what it is, then give an example of how you actually used it in a Git & GitHub codebase.