Before we start, this guide assumes that you already have GitHub Copilot installed and configured in VS Code.
If you haven’t set it up yet, you can find the official installation instructions here.

A clear and consistent commit message convention is essential for the maintainability and understanding of any project.
In this post, I’ll show you how to use GitHub Copilot to automate and standardize your commit messages in VS Code — following the Conventional Commits style with emojis — in just a few minutes.

1. Define commit message rules in VS Code

The first step is to tell Copilot how you want your commit messages to be written.
You can do this by adding a configuration block in your VS Code settings.json file.

🧩 Open or create settings.json

  1. Open the command palette (Cmd + Shift + P or Ctrl + Shift + P).
  2. Search for “Preferences: Open Settings (JSON)”.
  3. Add the following configuration:
{
  "github.copilot.commitMessageGeneration.instructions": [
    { "text": "Always write commit messages in English. Never switch languages." },
    { "text": "Use this exact format: <emoji> <type>: <description>." },
    { "text": "Follow Conventional Commits for <type>. Valid types: feat, fix, docs, style, refactor, perf, test, chore, ci, warnings, security, move, architecture, add-dep, remove-dep, seed, dx, types, business, ux, minor-fix, errors, remove, structure, hotfix, init, release, wip, ci-fix, pin-deps, ci-build, analytics, typos, revert, license, breaking, assets, accessibility, comments, db, logs, remove-logs, gitignore, snapshots, experiment, flags, animations, dead-code, validation, offline." },
    { "text": "Emoji map: feat=✨, fix=🐛, docs=📝, style=💄, refactor=♻️, perf=⚡, test=✅, chore=🔧, ci=🚀, warnings=🚨, security=🔒️, move=🚚, architecture=🏗️, add-dep=➕, remove-dep=➖, seed=🌱, dx=🧑‍💻, types=🏷️, business=👔, ux=🚸, minor-fix=🩹, errors=🥅, remove=🔥, structure=🎨, hotfix=🚑️, init=🎉, release=🔖, wip=🚧, ci-fix=💚, pin-deps=📌, ci-build=👷, analytics=📈, typos=✏️, revert=⏪️, license=📄, breaking=💥, assets=🍱, accessibility=♿️, comments=💡, db=🗃️, logs=🔊, remove-logs=🔇, gitignore=🙈, snapshots=📸, experiment=⚗️, flags=🚩, animations=💫, dead-code=⚰️, validation=🦺, offline=✈️." },
    { "text": "Use the imperative mood ('add', 'fix', not 'added' or 'fixed'). Keep the first line under 72 characters. Commits must be atomic (single purpose). Split unrelated changes." },
    { "text": "Do not add author signatures or assistant marks. Use '💥 breaking:' only for real breaking changes and explain them in the body if necessary." },
    { "text": "Only commit staged files if any exist; otherwise, summarize the main change from the diff." },
    { "text": "Do not end the subject line with a period. Use lowercase except for proper nouns." },
    { "text": "Examples: '✨ feat: add date filter to reports view', '🐛 fix: fix total calculation in cart', '♻️ refactor: extract email validation helper'." },
    { "text": "When appropriate, after one blank line, add a body with short bullet points explaining WHAT and WHY (not HOW)." }
  ]
}

This configuration tells Copilot exactly how to generate commit messages when you click “Generate Commit Message” from the Source Control panel.

💡 The clearer your rules, the more consistent the generated messages will be.

2. Generate your commits with Copilot

Once everything is set up:

  1. Stage your changes in VS Code.
  2. Open the Source Control panel.
  3. Click the sparkle icon ✨ next to the commit box.
  4. Select “Generate Commit Message”.

Copilot will analyze your staged changes and generate a commit message that follows your rules.
You can accept it as is or edit it before committing.


Conclusion

Integrating GitHub Copilot into your commit workflow helps you maintain a clean, consistent, and easily understandable repository.
By defining clear instructions in settings.json, you make sure every commit follows the same convention — no matter who wrote it.

Remember: good conventions make your history readable, your changelog predictable, and your future self grateful.


Useful references:


Thanks for reading me 😊