Configure gpg signing (importing an existing private key):
git config --global user.name 'your-name'
git config --global user.email 'your-email'
git config --global user.signingkey 'your-gpg-pubkey'
git config --global commit.gpgsign true
git config --global --list
sudo apt install gpg
gpg --import /path/to/private/key/file
gpg --list-secret-keys --keyid-format long
# necessary for it to work. see:
# https://gist.github.com/paolocarrasco/18ca8fe6e63490ae1be23e84a7039374?permalink_comment_id=3767413#gistcomment-3767413
export GPG_TTY=$(tty)
Delete all branches except for main:
git branch | grep -v 'main' | xargs git branch -D
Delete all tags:
git tag | xargs git tag -d
Soft reset the initial commit
git update-ref -d HEAD
Copy contents from another repository, keep commit history
git remote add source /path/to/source/repo
git fetch source
git merge source/main --allow-unrelated-histories
git remote remove source
Fetch a single tag from remote (https://stackoverflow.com/a/54635270):
git fetch source tag v0.31.1 --no-tags
Clone a repo including all its submodules recursively (https://stackoverflow.com/a/4438292):
git clone --recurse-submodules -j8 git://github.com/foo/bar.git