Skip to content
| Marketplace
Sign in
Visual Studio Code>SCM Providers>CommitAheadNew to Visual Studio Code? Get it now.
CommitAhead

CommitAhead

poojan0403

|
7 installs
| (1) | Free
Writes your commit message before you ask for it. Generates on git add, in the background, from more than the diff. Works with Copilot, an API key, Ollama, or nothing at all.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

CommitAhead

Writes your commit message before you ask for it.

No Copilot? No API key? Don't want to pay anyone? It still works.

Side by side: a typical AI commit tool spins for three seconds and produces "chore: update files"; CommitAhead is already filled in with a message that explains why, plus a ticket reference.

Every developer freezes for a few seconds at git commit. Under pressure the message becomes fix stuff, wip, update. Research (Li & Ahmed, ICSE 2023) found low-quality commit messages are roughly 1.5× more likely to precede bug-introducing changes, and that message quality quietly degrades over a project's life.

Existing tools generate at commit time (you ask, then wait) and read only the diff (so they tell you what changed, which you already know). CommitAhead does the opposite:

  • Generates on git add, in the background. By the time you commit, the message is already in the Source Control box, and already waiting for git commit in your terminal. Zero wait.
  • Reads more than the diff. Branch name, ticket id, your recent commits, and the repository's own conventions (commitlint, .gitmessage, observed history), so the message can say why, use the scopes your team actually uses, and pass your own linter.
  • Never blocks, never overwrites, never phones home. The git hook always exits 0. Text you typed is never replaced. There is no telemetry and no server.

It works at every level of "I don't want to set anything up"

Tier You have Setup What you get
1. GitHub Copilot A Copilot subscription in VS Code Click Enable AI messages once (VS Code shows its consent dialog) Frontier-model messages through your existing subscription. No key, no signup. Uses Copilot model families that don't consume premium requests by default.
2a. API key An OpenAI / Anthropic / Azure / OpenRouter / Groq key Paste it once (stored in VS Code's secret storage) Same quality on your own account. Cents a month at commit volumes.
2b. Ollama Ollama running locally Nothing, it's auto-detected Fully offline. The diff never leaves your machine.
3. Nothing No Copilot, no key, no Ollama, no internet Nothing The built-in generator parses the branch name, changed paths and change types and assembles a real Conventional Commit.

Tier 3 is also the error path: whatever goes wrong with a model, you never get a blank box.

branch  fix/PROJ-882-login-handler
staged  src/auth/loginHandler.ts (modified)

→  fix(auth): update login handler

   Refs: PROJ-882

Not brilliant. But never broken, and considerably better than update.

Install

  • VS Code Marketplace: search for CommitAhead, or run ext install poojan0403.commit-ahead.
  • Open VSX (Cursor, VSCodium, Gitpod, code-server, GitLab Web IDE): search for CommitAhead.
  • From a .vsix: code --install-extension commit-ahead-<version>.vsix.

Requires VS Code 1.90 or later and git on your PATH. In Remote-SSH, WSL and dev containers the extension runs where the repository is.

Use it

  1. Stage something. Within half a second a message appears in the Source Control input box. Edit it or commit as is.
  2. Want AI-written messages? Click the Copilot icon in the Source Control title bar (or run CommitAhead: Enable AI Commit Messages). VS Code asks for consent once; from then on every stage is precomputed with Copilot.
  3. No Copilot? Click the CommitAhead item in the status bar to pick a provider, paste an API key, or point at Ollama.
  4. Want it in the terminal too? The first time it runs, CommitAhead asks once: Yes, all my repos installs its prepare-commit-msg hook in every repository you open (existing hooks are kept and run first); Ask per repo offers it per repository instead. From then on git add . && git commit opens your editor with the message already written. You can change this any time from the status bar item or with commitAhead.hookInstall.

The sparkle icon in the Source Control title bar regenerates on demand, ignoring the cache. If you have typed your own text it asks before replacing it.

What leaves your machine, and when

Provider What is sent To whom When
Built-in (Tier 3) Nothing Nobody Never
Ollama The redacted, size-budgeted staged diff, file list, branch name, recent commit subjects Your own machine (localhost:11434) On every stage, after a 400 ms debounce
GitHub Copilot Same GitHub, through the VS Code language model API, under your Copilot terms Only after you clicked Enable once
API key Same The endpoint you configured (commitAhead.apiBaseUrl) Only after you stored a key

Before anything is sent:

  • Secrets are redacted. AWS/GCP/GitHub/OpenAI/Anthropic/Stripe/Slack key formats, private key blocks, JWTs, connection-string passwords, Authorization headers, keyword assignments (password = …) and high-entropy strings are replaced with [redacted-…]. .env* file contents are removed entirely.
  • Noise is excluded. Lockfiles, build output, minified and generated code, binaries, images, snapshots, vendored code and key material are listed by name but their content is never sent. Add your own patterns in commitAhead.ignore or a .commitaheadignore file.
  • Size is budgeted. Diffs are counted with a real tokenizer and, when over commitAhead.maxDiffTokens, summarised per file; generation never fails on size.

To send nothing at all, set commitAhead.provider to deterministic, or commitAhead.enabled to false to turn background generation off. The git hook itself never makes a network call: it only reads a local cache file.

There is no telemetry, no analytics, no account and no server. The only network calls are the model requests you configured. The CommitAhead output channel logs every provider attempt so you can see exactly what happened.

Terminal commits: the hook

The prepare-commit-msg hook is installed automatically when commitAhead.hookInstall is always (the first-run question sets it), offered once per repository when it is ask, or by hand with CommitAhead: Install Git Hook. It is POSIX sh, needs no Node, and does three things: computes the staged tree hash, checks whether the extension already generated a message for exactly that tree, and if so prepends it to the commit message file. Every exit path is exit 0, so it can never block a commit.

It stands down for --amend, -m, merges, squashes and templates, and when you (or an earlier hook) already wrote a message.

  • Existing hook? It is backed up byte-for-byte as prepare-commit-msg.pre-commit-ahead and run first, with its exit code respected.
  • Husky? The hook goes where Husky expects it (.husky/prepare-commit-msg), never into .git/hooks, which git ignores when core.hooksPath is set. It is a tracked file: commit it to share it with the team, or leave it uncommitted.
  • lefthook or pre-commit? Nothing is written to your hooks. You get a config snippet that calls the CommitAhead script, so your hook manager stays in charge.
  • Uninstall: CommitAhead: Uninstall Git Hook restores the backup exactly and removes the cache directory (<git-dir>/.commit-ahead/).

How the message is made

  1. Context: branch name (type hint and ticket id), staged file list with change types and line counts, the redacted and budgeted diff, and the last commits as style examples.
  2. Conventions: commitlint config (type-enum, scope-enum, lengths, case) when present, commit.template hints, otherwise statistics over the last 100 commits: are they Conventional Commits, which scopes recur, how long are subjects, does anyone write bodies.
  3. Generation: the first available provider in the chain. Scopes are pinned to the ones your repository actually uses, so feat(auth) and feat(authentication) stop fragmenting your changelog.
  4. Verification: subjects that only restate a file name, disallowed types, unknown scopes and over-long headers are rejected and retried once with the reason fed back. If the repository has commitlint installed, the message is run through it. Bodies that merely restate the diff are dropped: a subject-only message beats an invented "why".
  5. Footers: Refs: <ticket> from the branch and any configured co-authors are added mechanically. No model ever writes them.

Messages are cached per staged tree under <git-dir>/.commit-ahead/ (pruned after 7 days, capped at 100 files) so restaging the same content costs nothing.

Settings

Setting Default What it does
commitAhead.enabled true Generate in the background when files are staged
commitAhead.provider auto auto (Copilot → API key → Ollama → built-in), copilot, apiKey, ollama, deterministic
commitAhead.generateOn stage stage or manual (only the regenerate command)
commitAhead.ticketPattern [A-Z][A-Z0-9]+-\d+ Regex for the ticket id in branch names (882-thing also yields #882)
commitAhead.maxSubjectLength 72 Header length limit; commitlint or a .gitmessage can only tighten it
commitAhead.includeBody true Allow a body when there is a real reason to state
commitAhead.copilotModel "" Copilot model family; empty picks a non-premium model
commitAhead.apiBaseUrl https://api.openai.com/v1 Any OpenAI-compatible base URL (Anthropic: https://api.anthropic.com/v1; Azure deployments are detected)
commitAhead.apiModel gpt-4o-mini Model for the API endpoint
commitAhead.ollamaUrl http://localhost:11434 Ollama server
commitAhead.ollamaModel qwen2.5-coder Ollama model; falls back to any installed coding model
commitAhead.maxDiffTokens 6000 Diff token budget before per-file summarisation
commitAhead.ignore [] Extra globs whose content is never sent
commitAhead.coAuthors [] Name <email> trailers added to every message (git-mob's git-mob.co-author is picked up too)
commitAhead.runCommitlint true Run the repository's commitlint on generated messages
commitAhead.offerHookInstall true Offer the terminal hook once per repository

The API key is never a setting. Run CommitAhead: Set API Key and it goes into VS Code's secret storage (your OS keychain).

Commands

Command
CommitAhead: Generate Commit Message Now Regenerate for the current repository, ignoring the cache (sparkle icon in Source Control)
CommitAhead: Enable / Disable AI Commit Messages (GitHub Copilot) One-time Copilot consent, and the way to turn it back off
CommitAhead: Choose Provider… The status bar picker: switch provider, set keys, endpoints and models
CommitAhead: Set API Key… / Clear API Key Secret storage only
CommitAhead: Install Git Hook / Uninstall Git Hook / Show Git Hook Status Terminal delivery
CommitAhead: Show Log The output channel with every decision the extension made

Known limitations

  • git commit --amend is left alone. The hook stands down on amend; the sidebar message is not applied to an amend either. Planned for a later release.
  • No autocomplete on a half-typed git commit -m ". VS Code exposes no stable API for reading terminal input; the hook is the supported path.
  • GitHub Copilot only works in VS Code itself. Copilot is not licensed for forks such as Cursor or VSCodium. There, CommitAhead tells you so and falls back to an API key, Ollama or the built-in generator.
  • The VS Code Git extension API can shift between releases. CommitAhead uses it for discovery and the input box, watches .git/index directly to detect staging, and falls back to workspace-folder discovery if the API is unavailable.
  • Speculative generation before staging (predicting what you are about to stage) is deferred to a later version.

Contributing and support

Bug reports and ideas are welcome: see CONTRIBUTING.md. Attach the CommitAhead log; it never contains your diff, your key or your secrets.

MIT licensed. Free forever: there is nothing to pay for and nothing for the maintainer to run.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft