Skip to main content

How do Mistral Code suggestions integrate with version control tools such as Git?

Updated this week

Mistral Code is designed to assist you in writing and modifying code, and these changes can be seamlessly integrated into your existing version control workflows, such as those using Git.

Incorporating Mistral Code's output into your codebase

Code suggested or generated by Mistral Code becomes part of your project files as long as you accept the suggestions and save your files.

1. Direct code completion

When Mistral Code provides code completion suggestions as you type, accepting these suggestions (e.g., by pressing Tab or a specific accept key) directly inserts the suggested code into your active file.

πŸ”‘ These suggestions are not staged or committed by default until you explicitly do so using your IDE's or Git's tools.

2. Code generation via the chat interface

When you use the Mistral Code chat panel to request code generation (e.g., "write a Python function to sort a list"), the AI will provide the code directly within the chat.

You can then typically use buttons like Apply to file, Insert at cursor, or a simple copy/paste action to transfer this generated code into your desired file and location.

πŸ”‘ Once the code from Mistral Code is incorporated into your files, it becomes just like any other code you've written manually and can be staged and committed using your usual Git commands (e.g., git add and git commit)

Assisting with commit messages

Additionnaly, Mistral Code offers the /commit command that you may use directly within the Chat interface, both in VS Code and JetBrains IDEs extensions.

πŸ”‘ This command can generate a ready-to-use commit message based on your currently staged changes, helping you write clear and consistent commit messages more quickly.

Did this answer your question?