Generating commit message via GitLens and Copilot

Post created: Thu, 14 Nov 2024 21:00:00 +0800

Background

I have recently discovered a nice feature for GitLens integration on GitHub Copilot, that lets you generate commit messages using o1-preview or o1-mini without the need of typing them.

Emm wait, isn’t GitHub Copilot already have such feature?

Figure: Already exists? Yes, but it turns out that the extension uses GPT-4o models by default (source: trust me bro), and seems like there is no way to change it. If you want to use more advanced model (e.g. o1 family from OpenAI), you can follow my steps. (Notify me if there is indeed a way!)

This is how to use the feature:

  1. Install GitLens extension and GitHub Copilot extension

    Update (Nov 20, 2024): You need to switch GitLens to Pre-release edition after you have installed it to work with Copilot extension. Pre-release version of GitLens

  2. Make changes by code something new
  3. Proceed to Source Control (press Ctrl+Shift+G, followed by G), hover on the SOURCE CONTROL collapsable menu, and click the three horizontal dot button (More Actions...)
  4. Click “Generate Commit Messages (GitLens)” Generate Commit Messages (GitLens)
  5. Choose a model you like Choose a model
  6. Wait, if you use o1 models, it will take a long time

Result

This is what o1-preview gives me:

Add guide on generating commit messages with GitLens

  • Introduce a blog post explaining how to use GitLens and GitHub Copilot to automatically generate commit messages without typing.
  • Include screenshots and update CSS to enhance image display.
  • Organize image assets and update references for better structure.