Skip to main content

Git

Commit messages

npm install -g commitizen
npm install -g cz-conventional-changelog
echo '{ "path": "cz-conventional-changelog" }' > ~/.czrc

Global configuration & ignore

~/.config/git/config
[user]
name = Yuanji
email = [email protected]
signingkey = 3CB6EA7C55827AAD

[core]
quotepath = false
pager = delta

[interactive]
diffFilter = delta --color-only

[delta]
navigate = true

[merge]
conflictstyle = diff3

[diff]
colorMoved = default

[commit]
gpgsign = true

[init]
defaultBranch = main

Project wise configuration

.git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = [email protected]:masakichi/wiki.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
remote = origin
merge = refs/heads/main
[user]
name = Yuanji
email = [email protected]
signingkey = 3CB6EA7C55827AAD
[commit]
gpgsign = true

Git log

List commit message between two tags

git log --pretty="%s" --no-merges  v1.8.12..v1.9.0

Ref: Git - pretty-formats Documentation

Pre-commit

A framework for managing and maintaining multi-language pre-commit hooks.

For more information see: https://pre-commit.com/

Installation

sudo pacman -S python-pre-commit

Current repository's configuration

.pre-commit-config.yaml
--8<-- ".pre-commit-config.yaml"

Ref: supported hooks

Setup git hooks

pre-commit install

Tips

Update git commit author date when amending

git commit --amend --date=now