Creates vanity git commit hashes by adjusting commit timestamps
This tool modifies git commits. While it preserves the commit content, if successful, it will change the commit hash immediately without a confirmation step.
DO NOT USE THIS, if you do not completely understand:
- why it is an actively terrible idea to do this, and why this entire project should not exist
- particulatly, why you should never use this on a shared remote
- how git SHAs are generated, how you would achieve this functionality manually
- the below-porcelain tools git gives you to undo anything this program does
I apologise in advance if this breaks anything on you but accept strictly zero responsibility - you run this at your own risk - good luck, sailor.
vein
allows you to modify your latest Git commit to have a specific SHA-1 prefix without changing the commit's content, tree, or parent relationships. It works by searching through different committer timestamps until it finds one that produces a hash with your desired prefix. It may fail to find, in which case it'll do nothing to the tree and print an error, but i'm pretty sure it'll still exit 1.
-
Ensure you have Rust and Cargo installed (https://rustup.rs/)
-
Clone and build:
git clone <repository-url>
cd vein
cargo build --release
The compiled binary live be at target/release/vein
Run vein
in a Git repository to modify the latest commit's hash:
# Use default prefix (22aa)
vein
# Specify a custom prefix
vein abcd
# Get help
vein --help
The program will search through different timestamps until it finds one that produces a commit hash starting with your specified prefix.
- clone & build as above
- added
$HOME/.cargo/bin
to my PATH - cargo install
cargo install --path . # at the root of the repo