This guide shows how to use Commitizen for better commits and automatic version bumping for GitHub releases.
Current Branch: develop (will switch to master in the future)
Instead of regular git commit, use the interactive commit tool:
npm run commitThis will guide you through:
- Type: Select commit type (feat, fix, docs, etc.)
- Scope: Optional area of change (auth, ui, api, etc.)
- Description: Short description of the change
- Body: Optional longer description
- Breaking Changes: If this breaks existing functionality
- Issues: Reference any GitHub issues
| Type | Description | Example |
|---|---|---|
feat |
New feature | feat(auth): add login system |
fix |
Bug fix | fix(ui): resolve button alignment |
docs |
Documentation | docs(readme): update install guide |
chore |
Maintenance | chore(deps): update electron |
refactor |
Code cleanup | refactor(api): simplify auth logic |
test |
Tests | test(auth): add login tests |
perf |
Performance | perf(ui): optimize rendering |
-
Make sure all changes are committed
git status # Should be clean -
Preview what will happen
npm run version:dry
-
Create release automatically
# Auto-detect version bump based on commits npm run version:auto # Or force specific version bump npm run version:patch # 0.0.1 → 0.0.2 npm run version:minor # 0.1.0 → 0.2.0 npm run version:major # 1.0.0 → 2.0.0
-
Push to GitHub
git push --follow-tags origin develop
-
Create GitHub Release
- Go to GitHub → Releases → "Create a new release"
- Select the new tag (e.g.,
v0.1.0) - Copy content from generated CHANGELOG.md
- Publish release
-
Make sure all changes are committed
git status # Should be clean -
Update version in package.json manually
# Edit package.json, change version from "0.0.1" to "0.1.0" -
Create a git tag
git add package.json package-lock.json git commit -m "chore(release): v0.1.0" git tag v0.1.0 -
Push to GitHub
git push origin develop git push origin v0.1.0
-
Create GitHub Release
- Go to GitHub → Releases → "Create a new release"
- Select tag
v0.1.0 - Write release notes based on your commits
- Create a changelog manually if needed
- Publish release
-
Create a feature branch from develop
git checkout develop git pull origin develop git checkout -b feature/new-auth
-
Make changes and commit
# Make your changes npm run commit # Use commitizen # Select: feat # Scope: auth # Description: add user authentication system
-
Push and create PR
git push origin feature/new-auth # Create PR to merge into develop
-
Create a fix branch from develop
git checkout develop git pull origin develop git checkout -b fix/button-alignment
-
Make changes and commit
# Fix the bug npm run commit # Use commitizen # Select: fix # Scope: ui # Description: resolve button alignment issue
-
Push and create PR
git push origin fix/button-alignment # Create PR to merge into develop
-
Prepare release on
developbranchgit checkout develop git pull origin develop # Make sure all features/fixes are merged # Run tests to ensure everything works npm run ci
-
Create release
# Edit package.json version manually (e.g., 0.0.1 → 0.1.0) git add package.json package-lock.json git commit -m "chore(release): v0.1.0" git tag v0.1.0
-
Push to GitHub
git push origin develop git push origin v0.1.0
-
Create GitHub Release
- Go to GitHub → Releases → "Create a new release"
- Select tag
v0.1.0 - Title:
v0.1.0 - Description: Write release notes based on your commits since the last release
- Attach build files if needed (from
dist-electron/) - Publish release
-
Create
hotfix branchfromdevelopgit checkout develop git checkout -b hotfix/critical-bug # Fix the critical bug npm run commit # Type: fix
-
Merge and release
git checkout develop git merge hotfix/critical-bug # Bump patch version (0.1.0 → 0.1.1) # Edit package.json manually git add package.json package-lock.json git commit -m "chore(release): v0.1.1" git tag v0.1.1 git push origin develop git push origin v0.1.1
-
Create GitHub Release (same process as above)
When you run npm run version:auto, it will:
- Analyze commits since the last release
- Determine version bump:
feat:commits → Minor version bump (0.1.0 → 0.2.0)fix:commits → Patch version bump (0.1.0 → 0.1.1)BREAKING CHANGE:→ Major version bump (1.0.0 → 2.0.0)
- Update version in package.json and package-lock.json
- Generate CHANGELOG.md with categorized changes
- Create git commit with message
chore(release): vX.Y.Z - Create git tag
vX.Y.Z
| Command | Description |
|---|---|
npm run commit |
Interactive commit with commitizen |
npm run version:dry |
Preview next version without making changes |
npm run version:auto |
Auto-detect version bump based on commits |
npm run version:patch |
Force patch bump (0.0.1 → 0.0.2) |
npm run version:minor |
Force minor bump (0.1.0 → 0.2.0) |
npm run version:major |
Force major bump (1.0.0 → 2.0.0) |
make commit |
Makefile shortcut for commit |
make version_dry |
Makefile shortcut for dry run |
make version_auto |
Makefile shortcut for auto version |
Before creating a release:
- All features/fixes are merged to develop
- All tests pass (
npm run ci) - Version number is updated in package.json
- Commit messages follow conventional format
- No uncommitted changes (
git status)
For GitHub release:
- Tag is pushed to GitHub
- Release notes describe main changes
- Build artifacts attached if needed
- Release is published
- Use descriptive commit messages: They become your release notes
- Keep commits focused: One feature/fix per commit
- Test before releasing: Run
npm run cito ensure quality - Version semantically:
- Patch (0.0.1 → 0.0.2): Bug fixes
- Minor (0.1.0 → 0.2.0): New features
- Major (1.0.0 → 2.0.0): Breaking changes