Git

Commit case-change file renames

git mv -f README.md readme.md

GPG sign commits

[user]
    …
    email = example@example.com
    signingkey = 00000000

Verify commits

git verify-commit c567d83

Rename branches

git branch -m old new

Githooks

Executing local hooks from global hooks

#!/usr/bin/env bash

if [ -e ./.git/hooks/commit-msg ]; then
    ./.git/hooks/commit-msg "$@"
fi

…

Hooks won’t work

chmod +x?

Push to upstream by default

Just set your push.default to upstream to push branches to their upstreams (which is the same that pull will pull from […]), rather than pushing branches to ones matching in name (which is the default setting for push.default — matching).

Brian Campbell on Stack Overflow

[push]
    default = upstream

Useful for easily pushing to a remote branch with a name different from that of the local branch. Long-form method:

git push origin local-branch:remote-branch

Patches

Generating patches

git format-patch --to example@example.com head~..head

Applying patches

git apply 0001-Example.patch
git am 0001-Example.patch