From bc9fd5d81b784482ce3997fdd288d6c81baecfa6 Mon Sep 17 00:00:00 2001 From: Mikkel Georgsen Date: Mon, 30 Mar 2026 22:33:39 +0200 Subject: [PATCH] [nexus] chore(01-02): install commit-msg hook and enable git rerere - Add scripts/nexus-commit-msg-hook.sh (tracked source for hook) - Install hook at .git/hooks/commit-msg (executable) - Enable git rerere with autoupdate for automated conflict re-resolution --- scripts/nexus-commit-msg-hook.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 scripts/nexus-commit-msg-hook.sh diff --git a/scripts/nexus-commit-msg-hook.sh b/scripts/nexus-commit-msg-hook.sh new file mode 100755 index 00000000..ab73bcf1 --- /dev/null +++ b/scripts/nexus-commit-msg-hook.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# Nexus fork: enforce [nexus] prefix on all fork commits +# Allows upstream merge commits and rebase-generated commits through +MSG_FILE="$1" +FIRST_LINE=$(head -1 "$MSG_FILE") + +# Skip merge commits (git generates these automatically during rebase/merge) +if echo "$FIRST_LINE" | grep -qE "^Merge (branch|pull request|remote-tracking)"; then + exit 0 +fi + +# Skip fixup/squash commits (used during interactive rebase) +if echo "$FIRST_LINE" | grep -qE "^(fixup|squash)!"; then + exit 0 +fi + +# Enforce [nexus] prefix +if ! echo "$FIRST_LINE" | grep -qE "^\[nexus\]"; then + echo "ERROR: Commit message must start with [nexus]" + echo " Got: $FIRST_LINE" + echo " Example: [nexus] feat: add branding package" + exit 1 +fi