- 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
23 lines
722 B
Bash
Executable file
23 lines
722 B
Bash
Executable file
#!/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
|