Git Goro for VS Code
Mine beautiful Git commit hashes. Proof of Work, but the work is completely pointless.
Git Goro adds a Vanity Commit action to the Source Control view. Stage
your changes as usual, write the commit message in the usual box, pick a
7-character hexadecimal prefix such as 114514b, and the extension searches
for a real, ordinary Git commit whose hash starts with it. GitHub, GitLab,
Gitea and Bitbucket see a perfectly normal commit.
The extension is a thin front end for the git-vanity command
line tool. All hashing and all Git writes happen in that separate Rust process;
VS Code only talks to it through the documented, versioned JSON protocol
(docs/protocol.md). The extension never downloads or
installs anything by itself.
Requirements
- VS Code 1.85 or newer, with the built-in Git extension enabled.
- The
git-vanity executable, version 1.x (protocol version 1). Install it
with one of:
cargo install --path crates/vanity-cli from a checkout of the git-vanity
repository (puts git-vanity into ~/.cargo/bin), or
- a release binary from the project's GitHub Releases page, placed on your
PATH.
The extension looks for the executable in this order:
- the
gitVanity.executablePath setting (absolute path, ~/..., or a path
relative to the workspace folder);
git-vanity on PATH (git-vanity.exe on Windows, honoring PATHEXT
for .exe/.com);
~/.cargo/bin (or $CARGO_HOME/bin).
It then runs git-vanity version --json and refuses binaries that do not
speak protocol version 1, with a clear message and a button to open the
settings.
Usage
- Stage files in the Source Control view.
- Type the commit message in the Source Control message box.
- Click the sparkle button (Vanity Commit) in the Source
Control title bar, or run the command from the Command Palette.
- Enter the 7-character prefix.
- Watch the progress in the Git Goro panel and the status bar:
attempts, hashrate, elapsed time, the chance that a hit would have been
found by now, and the expected time. There is no completion percentage:
every attempt is an independent lottery ticket, so the expected remaining
time does not shrink while you wait.
- When a hash is found, confirm the modal dialog to create the commit.
- The commit appears in the Git history; the message box is cleared.
Git Goro: Mine Hash does the same search as a dry run and stops at the
result. You can copy the hash, preview the commit, and press Commit in the
panel later. If HEAD or the staged files changed in the meantime, the CLI
refuses to write (exit code 4) and you can search again.
Closing the panel does not stop a search; the status bar keeps showing the
hashrate and reopening the panel (click the status bar item or run
Git Goro: Show Panel) restores it. Stop a search with Cancel in the
panel or Git Goro: Cancel Mining.
What the extension asks before waiving a safety check
The CLI refuses some situations unless a flag explicitly acknowledges them. The
extension never passes these flags silently; it asks every time:
| Situation |
Flag after you agree |
Existing objects already start with the prefix (git show <prefix> would be ambiguous) |
--allow-ambiguous-prefix (or set gitVanity.allowAmbiguousPrefix) |
| Commit hooks exist; git-vanity does not run them |
--no-verify |
commit.gpgsign=true; git-vanity 1.0 cannot sign |
--no-gpg-sign (the commit is unsigned) |
| Nothing is staged |
--allow-empty |
Merges, rebases, cherry-picks and conflicts in progress are reported and not
supported in 1.0.
Nonce modes
- message (default): appends a visible
Vanity-Nonce: 000000123456
trailer to the commit message. Dates stay real.
- timestamp: keeps the message unchanged and moves the committer time (and,
with
gitVanity.varyAuthorTime, the author time) up to
gitVanity.timeWindow into the past. A 7-character prefix needs
varyAuthorTime (default on) to have a large enough search space.
In the panel, the Nonce Mode choice (from settings) (the default, like an
empty Threads field) uses gitVanity.nonceMode for the repository the search
runs in, even when the repository is only picked after you press Start.
Settings
| Setting |
Default |
Description |
gitVanity.executablePath |
"" |
Path to git-vanity. Empty: PATH, then ~/.cargo/bin. |
gitVanity.threads |
"auto" |
"auto" or 1-1024 worker threads. |
gitVanity.nonceMode |
"message" |
message or timestamp. |
gitVanity.maxAttempts |
0 |
Give up after about this many attempts; 0 = unlimited. |
gitVanity.timeWindow |
"24h" |
Timestamp mode window (90s, 30m, 24h, 7d, 2w). |
gitVanity.varyAuthorTime |
true |
Timestamp mode: also move the author time. |
gitVanity.allowAmbiguousPrefix |
false |
Do not ask when the short prefix is already used by an object. |
Multiple repositories
With several repositories open, the SCM title button uses the repository it
belongs to. From the Command Palette, a single repository is used directly;
otherwise a QuickPick asks which one.
Safety and privacy
- Everything runs locally. No telemetry, no network access, no downloads.
- The extension spawns
git-vanity with an argument array (shell: false);
your message is never interpolated into a shell command line.
- Mining is always a dry run. Only after you confirm does
git-vanity apply
re-verify HEAD, the branch and the staged tree, write the commit object and
update the branch with an atomic compare-and-swap. Nothing is forced, no
branch is switched, the working tree and index are never modified.
- Uninstalling the extension leaves your repositories untouched. When VS Code
closes, running searches are interrupted (SIGINT, then SIGKILL after 3 s).
Installing the VSIX locally
cd vscode-extension
npm install
npm run package # produces git-vanity-1.0.0.vsix
code --install-extension git-vanity-1.0.0.vsix
Development
npm install
npm run compile # tsc, strict mode
npm run test:unit # mocha, no VS Code needed (uses a fake CLI)
npm run test:integration # downloads VS Code into .vscode-test/ and runs the suite
npm run icon # regenerates media/icon.png
The tests use test/fixtures/fake-git-vanity.js, a small Node script that
honors the protocol (validated against docs/*.schema.json), and the
documented test mode GIT_VANITY_TEST_SHORT_PREFIX=1 so that 1-3 character
prefixes are found in milliseconds. If a built target/release/git-vanity or
target/debug/git-vanity exists (or GIT_VANITY_REAL_CLI points to one), the
integration suite also mines and commits with the real CLI in a temporary
repository; otherwise that test is skipped.
Publishing to the Marketplace requires a publisher account and a personal
access token (npx @vscode/vsce publish); the publisher field is a
placeholder until then.
License
MIT