Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

I Built a Git Hook That Makes Revert Commits Conventional

Описание и применение

Создан Git‑хук, который преобразует сообщения отката в формат Conventional Commits, обеспечивая единообразие истории коммитов.

Задача

Git’s default revert message does not conform to Conventional Commits format, causing inconsistencies in commit history.

Результат

Revert commits now match Conventional Commit syntax, improving consistency and tooling compatibility.

Рабочий процесс

  • Create a Git hook using prepare-commit-msg
  • Configure the hook to rewrite revert messages
  • Install globally or per repository
  • Set desired style via git config revert-hook.style
  • Run git revert and observe the rewritten message

Доказательства

The hook uses Git's prepare-commit-msg hook. It runs after Git prepares a revert message and before the editor opens.

Источник

The project has no test framework dependency. test.sh creates temporary Git repositories and exercises installation, overwrite protection, message rewriting, styles, fallback behavior, global installation, and cleanup.

Источник

  • Дата записи: 2026-09-15T23:01:13.878Z