Guide2025-01-28

How to Turn Git Commits Into a Changelog: The Complete Guide

Learn how to automatically generate professional changelogs from your git commit history. From conventional commits to automated tools, discover the best practices for keeping your users informed about every release.

ShipLog Team
2025-01-28
8 min read

How to Turn Git Commits Into a Changelog: The Complete Guide

Every developer knows the pain of manually writing release notes. You've just shipped a new version of your software, and now you need to document all the changes. But what if you could automatically generate a professional changelog directly from your git commit history?

The good news is that you can—and it's easier than you think. In this guide, we'll walk through the complete process of turning your git commits into meaningful changelogs that your users will actually want to read.

Why Automate Your Changelog?

Before we dive into the how, let's talk about the why:

  • Save Time: No more manually reviewing commits before each release
  • Reduce Errors: Eliminate the risk of missing important changes
  • Maintain Consistency: Every changelog follows the same format and style
  • Improve User Experience: Users get accurate, timely information about updates
  • Better Release Management: Clear visibility into what's changing in each version

The Foundation: Conventional Commits

The secret to automated changelog generation is using conventional commit messages. This standardized format makes your commits machine-readable while remaining human-friendly.

What Are Conventional Commits?

Conventional commits follow this structure:

<type>[optional scope]: <description>

[optional body]

[optional footer(s)]

Essential Commit Types for Changelogs

Not all commits should appear in your changelog. Here are the types that matter:

  • feat: New features for users
  • fix: Bug fixes that resolve user-facing issues
  • perf: Performance improvements
  • refactor: Code changes that improve maintainability
  • docs: Documentation updates (usually not in changelogs)
  • test: Test additions/changes (usually not in changelogs)
  • chore: Maintenance tasks (usually not in changelogs)
  • style: Code style changes (usually not in changelogs)

Examples of Changelog-Worthy Commits

1feat: add dark mode support to user interface 2feat(auth): implement OAuth 2.0 authentication 3fix: resolve memory leak in image processing 4fix(api): handle timeout errors gracefully 5perf: optimize database queries for user search 6refactor: simplify user validation logic

Setting Up Your Git Workflow

1. Install Commitizen (Optional but Recommended)

Commitizen helps enforce conventional commit format:

1npm install -g commitizen 2npm install -g cz-conventional-changelog

Then initialize it in your project:

1commitizen init cz-conventional-changelog --save-dev --save-exact

2. Configure Your Git Hooks

Set up pre-commit hooks to validate commit message format:

1npm install --save-dev @commitlint/cli @commitlint/config-conventional

Create .commitlintrc.js:

1module.exports = { 2 extends: ['@commitlint/config-conventional'], 3 rules: { 4 'type-enum': [ 5 2, 6 'always', 7 ['feat', 'fix', 'docs', 'style', 'refactor', 'perf', 'test', 'chore'] 8 ], 9 'subject-case': [2, 'always', 'lower-case'], 10 'subject-max-length': [2, 'always', 72] 11 } 12}

3. Set Up Husky for Git Hooks

1npm install --save-dev husky 2npx husky install 3npx husky add .husky/commit-msg 'npx --no -- commitlint --edit "$1"'

Manual Changelog Generation

If you prefer to start manually, here's how to generate a changelog from your git history:

Using Git Log Commands

1# Get all commits since the last tag 2git log $(git describe --tags --abbrev=0)..HEAD --oneline 3 4# Get commits with more detail 5git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"- %s (%h)" --grep="^feat\|^fix\|^perf\|^refactor" 6 7# Get commits by type 8git log --grep="^feat" --pretty=format:"- %s (%h)" 9git log --grep="^fix" --pretty=format:"- %s (%h)"

Creating a Basic Changelog Template

1# Changelog 2 3All notable changes to this project will be documented in this file. 4 5## [Unreleased] 6 7### Added 8- List new features here 9 10### Changed 11- List changes in existing functionality here 12 13### Deprecated 14- List soon-to-be removed features here 15 16### Removed 17- List removed features here 18 19### Fixed 20- List any bug fixes here 21 22### Security 23- List security fixes here 24 25## [1.0.0] - 2025-01-28 26 27### Added 28- Initial release

Automated Changelog Generation

While manual generation works, automation is where the real magic happens. Here are some popular tools:

1. Conventional Changelog CLI

1npm install --save-dev conventional-changelog-cli

Generate a changelog:

1npx conventional-changelog -p angular -i CHANGELOG.md -s

2. GitHub Actions Integration

Create .github/workflows/changelog.yml:

1name: Generate Changelog 2 3on: 4 push: 5 tags: 6 - 'v*' 7 8jobs: 9 changelog: 10 runs-on: ubuntu-latest 11 steps: 12 - uses: actions/checkout@v3 13 with: 14 fetch-depth: 0 15 16 - name: Generate Changelog 17 run: | 18 npx conventional-changelog-cli -p angular -i CHANGELOG.md -s -r 0 19 20 - name: Commit Changelog 21 run: | 22 git config --local user.email "action@github.com" 23 git config --local user.name "GitHub Action" 24 git add CHANGELOG.md 25 git commit -m "docs: update changelog for ${{ github.ref_name }}" 26 git push

3. ShipLog: The Professional Solution

For teams that want a more sophisticated approach, ShipLog provides enterprise-grade changelog automation:

  • Automatic Webhook Integration: Connects directly to your GitHub repository
  • Smart Change Detection: Automatically categorizes commits and pull requests
  • Professional Templates: Beautiful, branded changelog pages
  • Team Collaboration: Multiple team members can review and edit before publishing
  • Custom Domains: Host changelogs on your own domain
  • Analytics: Track how users engage with your changelogs

Best Practices for Commit-Based Changelogs

1. Be Specific in Your Commits

1# ❌ Too vague 2fix: fix bug 3 4# ✅ Specific and actionable 5fix: resolve login timeout on slow connections

2. Use Scopes for Better Organization

1feat(auth): add two-factor authentication 2fix(api): handle rate limiting errors 3perf(database): optimize user search queries

3. Write Clear, User-Focused Descriptions

1# ❌ Technical implementation details 2feat: implement JWT token validation middleware 3 4# ✅ User-focused description 5feat: add secure authentication with JWT tokens

4. Include Breaking Changes

1feat!: remove deprecated API endpoints 2 3BREAKING CHANGE: The following endpoints have been removed: 4- /api/v1/users/legacy 5- /api/v1/auth/basic

Advanced Techniques

1. Linking Issues and Pull Requests

1feat: add user profile management 2 3Closes #123 4Related to #456

2. Grouping Related Changes

1feat(auth): implement OAuth 2.0 authentication 2 3- Add OAuth 2.0 provider integration 4- Implement refresh token rotation 5- Add social login options (Google, GitHub)

3. Semantic Versioning Integration

Automatically determine version bumps based on commit types:

  • feat: Minor version bump
  • fix: Patch version bump
  • BREAKING CHANGE: Major version bump

Common Pitfalls to Avoid

1. Inconsistent Commit Messages

1# ❌ Mixed formats 2feat: add new feature 3Added another feature 4FIX: bug fix 5 6# ✅ Consistent conventional format 7feat: add new feature 8feat: add another feature 9fix: resolve bug

2. Including Irrelevant Commits

1# ❌ These shouldn't be in changelogs 2chore: update dependencies 3style: fix formatting 4test: add unit tests 5 6# ✅ These should be in changelogs 7feat: add user dashboard 8fix: resolve login issue 9perf: optimize search algorithm

3. Vague Change Descriptions

1# ❌ Unclear what changed 2fix: fix stuff 3feat: add things 4 5# ✅ Clear and specific 6fix: resolve memory leak in image upload 7feat: add dark mode toggle to settings

Setting Up Your First Automated Changelog

Here's a step-by-step guide to get you started:

Step 1: Install Dependencies

1npm install --save-dev conventional-changelog-cli 2npm install --save-dev @commitlint/cli @commitlint/config-conventional 3npm install --save-dev husky

Step 2: Configure Commit Linting

Create .commitlintrc.js:

1module.exports = { 2 extends: ['@commitlint/config-conventional'] 3}

Step 3: Set Up Git Hooks

1npx husky install 2npx husky add .husky/commit-msg 'npx --no -- commitlint --edit "$1"'

Step 4: Create Initial Changelog

1npx conventional-changelog -p angular -i CHANGELOG.md -s -r 0

Step 5: Make Your First Conventional Commit

1git add . 2git commit -m "feat: add automated changelog generation"

When to Use Different Approaches

Manual Generation

  • Use for: Small projects, infrequent releases, learning purposes
  • Pros: Full control, no dependencies
  • Cons: Time-consuming, error-prone, inconsistent

Open Source Tools

  • Use for: Medium projects, teams comfortable with CLI tools
  • Pros: Free, customizable, community support
  • Cons: Requires setup, limited features, maintenance overhead

Professional Services (Like ShipLog)

  • Use for: Teams, businesses, frequent releases, professional appearance
  • Pros: Zero setup, beautiful UI, team collaboration, analytics
  • Cons: Monthly cost, less customization

Conclusion

Automating your changelog generation from git commits is one of the best investments you can make in your development workflow. It saves time, reduces errors, and ensures your users always have accurate information about your software updates.

The key is starting with conventional commits and gradually building up your automation. Whether you choose open-source tools or a professional service like ShipLog, the important thing is to get started.

Your future self (and your users) will thank you for it.

Next Steps

  1. Start Today: Begin using conventional commit messages in your next commit
  2. Set Up Linting: Install commit message validation to enforce the format
  3. Choose Your Tool: Decide between manual generation, open-source tools, or professional services
  4. Iterate: Start simple and add complexity as your needs grow

Remember, the best changelog system is the one you'll actually use. Start small, be consistent, and watch your release process become smoother with every update.


Ready to automate your changelog generation? Try ShipLog for free and see how easy it can be to turn your git commits into professional changelogs that your users love.

Enjoyed this article?

Share it with your team and stay updated with our latest insights.

How to Turn Git Commits Into a Changelog: The Complete Guide | ShipLog Blog