Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

git-vanity-sha

> 编程语言
Open source

vanity hex prefixes for your commit SHAs

300 stars0 likes1 views
WebsiteGitHub

About

vanity hex prefixes for your commit SHAs

git vanity-sha

This is a Very Good Program inspired by this tweet.

He wasn't joking.

So I thought maybe I'd just write a program to do it.

git vanity-sha will try its darndest to tweak the commiter timestamp of your last commit to produce a commit SHA using the hexadecimal prefix you supply.

$ git commit -am "refactor warp core"
[master 909939a] refactor warp core
 1 file changed, 12 insertions(+), 8 deletions(-)

$ git vanity-sha cafe
Searching for new SHA...

SHA found: cafe7f7fe2054aa79dd6f5e1f994242b70cd7572
Change committer timestamp to 2018-04-27 00:31:18 -0700? This will amend your commit.
(y/n): y

-----------------------------------------------
commit cafe7f7fe2054aa79dd6f5e1f994242b70cd7572
Author: Matt Baker 

refactor warp core

Now you can amend a commit to have a quirky prefix whenever you want except for when git-vanity-sha doesn't find one.

Installation

Grab the git-vanity-sha script and stick it in your path somewhere. Make sure you chmod +x it, and hash -r.

Now you can say git vanity-sha beef in your repo.

Frequently Asked Questions

How does it work?

git vanity-sha will attempt to find a commit SHA starting with the hex prefix you specify by applying a delta to the committer timestamp of your last commit. It starts off making small changes to the timestamp (a few seconds) and gets bigger as it searches (up to several days).

If it finds a timestamp that will cause your commit's SHA to have the target prefix, it will give you the option to amend that commit or abort the process.

Is this a good idea?

Absolutely not.

Will this mess something up?

Probably.

Will you help me if something goes wrong?

Oh god no.

It didn't find a SHA with the prefix I wanted :(

If you're really determined, then change TIMESTAMP_DELTA_MAX to a huge number and go for a walk and maybe you'll get lucky.

It doesn't work, the hash doesn't have the proper prefix!

Do you have commit signing enabled? You need to disable it, otherwise it won't work due to git limitations.

Issues· 4 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Ruby

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言