raphaelthomas.ch

Git-Fu

Force pushing …

… without the risk of destroying the work of others:

git push --force-with-lease

as opposed to the ungodly git push --force.

Signing git commits

Extend your Git configuration, e.g. in ~/.gitconfig with the following:

[user]
    signingkey = ~/.ssh/id_ed25519.pub
[gpg]
    format = ssh
[commit]
    gpgsign = true

Re-signing an existing repo

Say you want to retroactively sign all commits in a given repo. If you’re ready to rewrite the entire history, then you may do this:

git rebase --root --gpg-sign --committer-date-is-author-date

See https://rollen.io/blog/resigning-git-commits/ for a more in-depth explanation.