cederlys/git-as-a-blockchain
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
Git is basically a blockchain. The only thing that is missing is the
proof-of-work bit. We can easily add that to git using a pre-receive
hook. This repository contains a sample pre-receive hook.
Unless you are really lucky, you might want to run something like this
instead of "git push":
until git push origin main
do
sleep 1
git commit --amend --reset-author --no-edit
done
However, if you attempt to push multiple commits at once, you need
something more elaborate. And if you have more than 8 commits in the
repository (after your push), and don't want to wait a very long time,
you also need something more elaborate. This is left as an exercise
for the reader.
See githooks(1) for information on how to install this as a
pre-receive hook.