GITx — Commit Template for VS Code
Keeps the Source Control commit message in sync with the repository's commit template, merging its trailers into the message you are already writing.
If your team tags commits with Ticket: / Epic: / Initiative: trailers, the values are known long before you type the message — a worktree setup script, a git hook, or an AI agent already resolved them into a .gitmessage file. GITx applies that file to the commit box, so no ticket lookup and no credentials ever live in the editor.
Why GITx?
VS Code already reads commit.template natively — but only to seed an empty message. The moment you start typing, the template is gone, and there is no fallback when commit.template is unset. GITx fills that gap:
| Behavior |
Native VS Code |
GITx |
Prefill an empty message from commit.template |
✅ |
✅ |
| Merge trailers into a message already typed |
❌ |
✅ |
| Overwrite a stale trailer key in place |
❌ |
✅ |
.gitmessage fallback when commit.template is unset |
❌ |
✅ |
| Re-apply on template edit, saved or unsaved |
❌ |
✅ |
| Re-apply on branch switch and after a commit |
partial |
✅ |
| Idempotent — a key dropped from the template disappears |
❌ |
✅ |
- Universal Compatibility — Works in VSCodium, Cursor, Windsurf, and other VS Code-based IDEs. Published to the Open VSX Registry
- No values invented — GITx never generates a ticket number. Whatever wrote the template file owns the values
- 100% Local — No accounts, no Jira credentials, no cloud calls, no telemetry
- Zero config — Drop a
.gitmessage in the git root and it applies. commit.template is honored when set
- Worktree friendly — Each repository resolves its own template, so a per-worktree
.gitmessage applies itself
How it works
- The template file is resolved from git
commit.template, falling back to .gitmessage in the git root.
- Empty commit message → filled with the template, comment lines dropped.
- Non-empty commit message → the template's trailers are merged into it.
- A trailer key already present in the message is overwritten in place; the template is the source of truth.
- The template file is watched — saved edits and unsaved editor edits both re-apply.
- On branch switch and after a commit the template is re-read and re-applied.
No template file → GITx does nothing.
Example
.gitmessage in a worktree prepared for PROJ-1234:
Ticket: PROJ-1234
Epic: PROJ-2345
Initiative: PROJ-3456
You type:
Implement feature
whatever body
Committed message:
Implement feature
whatever body
Ticket: PROJ-1234
Epic: PROJ-2345
Initiative: PROJ-3456
Key Features
Template Resolution
- Git
commit.template read per repository, with ~ and repository-relative paths resolved
.gitmessage in the git root used when commit.template is unset
- Every repository the built-in Git extension reports is handled, each with its own template
- Unsaved editor content wins over the file on disk, so template edits apply before a save
Trailer Merge
- Follows
git interpret-trailers: the trailer block is the last paragraph when every line is Key: value
- A one-line subject such as
Fix: crash on startup is never mistaken for a trailer block
- Key matching is case insensitive
- Trailers you typed yourself are never touched — only keys the template owns
- Repeated runs are idempotent, no matter how the message was reformatted in between
Re-application
- File watcher on the template — create, change, delete
- Unsaved edits of the template picked up on every keystroke
- Branch switch and post-commit refill re-read the template
- GITx: Apply Commit Template command runs the same merge on demand, for a message some other tool replaced
Getting Started
- Put a
.gitmessage file in the git root, or set git config commit.template <path>
- Open the Source Control panel
- Type a commit message — the template's trailers are appended and kept in sync
Commands
| Command |
ID |
Effect |
| GITx: Apply Commit Template |
gitx.applyTemplate |
Merges the template into the commit message |
Settings
| Setting |
Description |
Default |
gitx.enabled |
Apply the repository's commit template to the commit message |
true |
gitx.templateFileName |
Template file looked up in the git root when commit.template is unset |
.gitmessage |
Limitations
- Trailer values are never generated by GITx; whatever prepared the file owns them.
- Only trailing
Key: value lines of the template are merged into a non-empty message. Subject and body of the template are used only to seed an empty message.
BOM (Bill of Materials)
| Package |
Version |
Purpose |
| none |
— |
No runtime dependencies. Template reading uses Node's fs, commit.template is read through the git binary, everything else is the VS Code API |
Build-time only:
| Package |
Version |
Purpose |
| esbuild |
^0.28.1 |
Bundles src/ into a single dist/extension.js |
| typescript |
^5.3.0 |
Type checking (tsc --noEmit) |
| prettier |
^3.8.1 |
Formatting check in make lint |
| @types/vscode |
^1.85.0 |
VS Code API typings |
| @types/node |
^20.19.41 |
Node typings for fs, path, child_process |
License: Proprietary | Created by abridge