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
toupstream
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 forpush.default
— matching).
[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
send-email
[sendemail]
smtpserver = mail.example.com
smtpuser = foo
smtpencryption = tls
smtpserverport = 587
from = foo-alias@example.com
confirm = auto
git send-email --to '~sircmpwn/email-test-drive@lists.sr.ht' head^
git send-email --annotate -v2 head^
Subdirectory filter
See Move files from one repository to another, preserving git history.