Boosting Your Dynamics 365 Business Central Workflow: Auto-Generate Commit Messages with GitHub Copilot in VS Code
Hello, Business Central developers! If you're deep in AL code customization for Microsoft Dynamics 365 Business Central, then you probably know the feeling: you’ve reworked table structures, added control to a Report Extension, or adjusted a PageExtension – now comes the commit, and you're stuck on the message. Something like "Updated report logic" is vague. You want clarity… but also speed.
Enter GitHub Copilot – your AI-powered sidekick baked into Visual Studio Code. It doesn’t just help with code snippets anymore. With one click (look for a sparkle ✨ icon), it can generate commit messages based on your staged changes. Think of it like an intelligent assistant that understands AL language and Business Central conventions – perfect for making those commits clear, helpful, and consistent.
This guide will show you how to use this feature in the Business Central environment, with walk-throughs on setup, prompt customization, and tips to make your commit messages not just automated – but actually useful.
Why Auto-Generated Commit Messages Matter in a BC Project
In a Dynamics 365 BC environment, you're constantly touching various AL elements – extending tables, modifying reports, adding tests for workflows, and so on. You might be working solo, or in a team. In either case, clear commit history is a lifesaver. Imagine reviewing a pull request with dozens of changes and meaningless messages like “fixed stuff.” Not helpful.
Copilot scans your diffs when you hit the commit prompt and generates a concise, intent-focused commit message. For example, let’s say you rewrote a Codeunit for handling inventory adjustments. Copilot could suggest:
fix(Codeunit 50102): Adjust posted transfer logic
Fixed negative entries in warehouse movements for inter-site transfers.
Even if it’s not perfect, the baseline gets you thinking – and adjusting – faster.
This also aligns with best practices in Dynamics projects where developers reference AL object types and IDs, and often follow structured conventions or frameworks to improve traceability.
Setting Up GitHub Copilot in VS Code for Business Central
Let’s get you underway with a quick setup guide:
-
Install the GitHub Copilot extension in Visual Studio Code.
- Open the Extensions sidebar (Ctrl+Shift+X or Cmd+Shift+X on macOS).
- Search “GitHub Copilot” and install it.
- Sign in with your GitHub account and activate your Copilot subscription.
-
Add the AL Language extension from Microsoft if it’s not already in your setup.
- While not specifically required for Copilot, it helps give VS Code better recognition of AL objects, aiding both coding and AI suggestions.
-
Start coding like usual.
- Work in your AL project – maybe you modify a PageExtension or add fields to a TableExtension.
- Once you’re done editing, go to the Source Control view and stage the changes.
-
Let Copilot generate the commit message.
- Once the changes are staged, click the sparkle icon in the commit message box (or press Ctrl+Enter).
- Copilot analyzes your changes and suggests a commit message based on the AL diffs.
Pro Tip: For better results, try to stage changes in logical chunks. For example, group report changes separate from test code or dependencies. This gives the AI cleaner context to work with.
Customizing GitHub Copilot’s Commit Prompts for Business Central
Default commit suggestions are pretty good, but in a Business Central project, precision matters. Want Copilot to include ticket numbers, follow Conventional Commits, or recognize AL object types? You can guide it with a custom instruction file.
Here’s how:
1. Create a Prompt Instruction File
At the root of your BC project (same level as app.json), create a file called:
.copilot-commit-message-instructions.md
The file name must match exactly and be in Markdown format.
2. Add Your Custom Instructions
Here’s a great starting point for a BC-flavored prompt:
You are generating commit messages for a Microsoft Dynamics 365 Business Central AL project. Consider staged file changes and infer intent. Use the Conventional Commits format:
- Start with type(scope): (e.g., feat(PageExtension 50500):)
- Use imperative mood
- Limit summary line to 50 characters
- Add description (why/impact) in a new paragraph
- Mention related tickets in square brackets (e.g., [BC-101])
- Include AL object IDs and object types where applicable
- Default to 'chore' when unsure
- Avoid vague messages like 'update code'
Examples:
feat(PageExtension 50500): Add filter to Customer List
Improves user productivity by enabling quick segmentation. [BC-321]
fix(Codeunit 50104): Correct invoice email logic
Prevented duplicate emails in background job execution.
refactor(Table 18): Simplify field validations
Code cleanup; no functional changes or regressions.
Save the file. Now, Copilot will consult this instruction set every time it generates a commit message in this workspace.
Want it to match your team’s ticketing system (like Jira or Azure DevOps)? Adjust the instruction part to reference your ticket syntax.
3. Test It Out
Next time you stage a change, invoke Copilot’s suggestion in the commit box. See if it follows your format. If it misses something, go back and refine your prompt file.
Some teams even include emojis or tags like 🔧, 🚀, or ⚙️ to indicate type of change – totally fair game if it aligns with your project’s style.
4. Watch for Common Issues
- Make sure the .md file is at the project root.
- Restart VS Code if Copilot isn't recognizing the prompt.
- Ensure your GitHub account has an active Copilot subscription.
Real-World Benefits for Business Central Devs
Here’s what you gain by enabling auto-generated commit messages with Copilot:
- 🚀 Faster Commit Process: No more writer's block for commit messages.
- 🧠 AL-Aware Suggestions: Copilot understands your AL changes, including terminology and object types.
- 📘 Readable History: Helpful messages make reviewing history or debugging so much clearer.
- 🤝 Team Consistency: A shared prompt file guides everyone toward a unified commit style.
- 🔄 Continuous Learning: With your edits and corrections, Copilot improves over time.
For Business Central, this is a great match – especially if you're managing different AL extensions or working across multiple environments.
Wrapping Up: A Smarter Way to Commit
We often focus solely on our code, but every commit is a conversation with your future self or a teammate. By using GitHub Copilot to generate commit messages in Visual Studio Code, tailored for AL projects, you’re speeding up development and boosting quality at the same time.
To get started:
- Set up Copilot and the AL extension in VS Code.
- Add the .copilot-commit-message-instructions.md file.
- Stage edits and let Copilot generate your next commit message.
Try it out today, tweak your prompts over time, and enjoy a more productive AL coding workflow in Business Central. And don’t forget – real magic happens when you shape the AI to your standards.
Happy committing! ✨
