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

๐Ÿ“Œ Introduction

This article introduces commitollama, an alternative to GitHub Copilot designed for generating commit messages using local LLMs, ensuring privacy for confidential projects. It outlines the installation process for the commitollama extension in VSCode and necessary setup steps to start using it effectively.

๐Ÿš€ Quick Start

How to use

  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

๐Ÿ” Recap

  • commitollama is a privacy-focused commit message generator alternative to GitHub Copilot.
  • The tool leverages open-source LLMs like Llama, Mistral, and Phi3.
  • Easy integration with VSCode through a simple extension installation process.
  • Users can easily retrieve models, run services, and generate commit messages efficiently.

๐Ÿ”— References

[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 & ChatGPT-4o Mini

Posted on

2024-09-04

Updated on

2025-02-28

Licensed under