[tutorial] Enhancing Commit Messages with commitollama: A Guide for VSCode and Local LLM Integration

commitollama

commitollama is an alternative to GitHub Copilot’s commit message generator, powered by open-source models such as Llama (Llama3, Gemma, Mistral, Phi3, etc. For projects where confidentiality is a concern, commitollama allows you to use a local Large Language Model (LLM), ensuring privacy.

How to use

Thanks to its contributors, commitollama can be directly integrated into VSCode by installing the extension and setting up Ollama.

  1. Install the extension in VSCode.
  2. Install Ollama to integrate the LLM.

Screenshot from 2024-09-04 22-35-57

Screenshot from 2024-09-04 22-37-24

Installing Ollama

Run the following command to install Ollama:

1
curl -fsSL https://ollama.com/install.sh | sh

Screenshot from 2024-09-04 23-01-51

After installation, you can run Ollama using:

1
ollama

This will display a list of available commands:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Usage:
ollama [flags]
ollama [command]

Available Commands:
serve Start ollama
create Create a model from a Modelfile
show Show information for a model
run Run a model
pull Pull a model from a registry
push Push a model to a registry
list List models
ps List running models
cp Copy a model
rm Remove a model
help Help about any command

Flags:
-h, --help help for ollama
-v, --version Show version information

Use "ollama [command] --help" for more information about a command.

Download the Phi3 model (3.8b) by running:

1
ollama pull phi3:3.8b

Start the Ollama service using:

1
ollama serve

If you encounter the error message Error: listen tcp 127.0.0.1:11434: bind: address already in use, you can find a solution here .

To restart Ollama, stop the current service and relaunch it:

1
2
systemctl stop ollama.service
ollama serve

To prevent the model from being deleted after downloading, refer to this discussion here .

Setting Up VSCode

  • After installing the extension, use a custom model for commit message generation.
  • Press the button in the interface to automatically generate the commit message.

image

[tutorial] Enhancing Commit Messages with commitollama: A Guide for VSCode and Local LLM Integration

https://hsiangjenli.github.io/blog/tutorial_commitollama/

Author

Hsiang-Jen Li

Posted on

2024-09-04

Updated on

2024-12-18

Licensed under