Git signing
Get git signing key ID:
# get keys
gpg --list-secret-keys --keyid-format SHORT
# key id is the one after rsa4096
rsa4096/XXXXXXXX
Setup .gitconfig
to sign automatically:
.gitconfig
[user]
useConfigOnly = true
email = ...
signingkey = <XXXXXXXX>
[commit]
gpgSign = true
[tag]
gpgSign = true
ref: https://git-scm.com/book/ms/v2/Git-Tools-Signing-Your-Work
ref: https://withblue.ink/2020/05/17/how-and-why-to-sign-git-commits.html
Git diff(ing): Generating and Applying code patches
# GENERATING
# head -1
git format-patch -1 HEAD
# head - 3 to head
git format-patch HEAD~3..HEAD
# generating a single patch across multiple commits
git format-patch cc1dde0dd^..6de6d4b06 --stdout > foo.patch
# generating diff from tags (can use --stat to only get the number of lines changed)
git diff 2.0.0 1.0.0 --stat
# generating patches for uncommited changes
git diff > my-changes.patch
# APPLYING
git apply <patch-file>
ref: https://www.geeksforgeeks.org/how-to-generate-and-apply-patches-with-git/
Using linux diff command
Can also be done from linux diff commands directly:
# GENERATING
# new code has the new changes we want to make as part of the patch
diff -ru <old code> <new code> > mychanges.patch
# APPLYING
# need to be in the directory in which you want to make the diff changes from
patch -i mychanges.patch
Encrypted git repos
Tbd
Git Convetional Commits
See versioning