Open
Description
(toca hacerlo por cada proyecto clonado, ergo por cada directorio .git)
- crear git hook
touch .git/hooks/prepare-commit-msg
- dar permisos de ejecución
chmod +x .git/hooks/prepare-commit-msg
- editar archivo de hook
vim .git/hooks/prepare-commit-msg
- escribir y guardar en el archivo
#!/bin/sh
BRANCH_NAME=$(git symbolic-ref --short HEAD)
if [ -n "$BRANCH_NAME" ]; then
# Remove the final '-I' from the branch name
BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's/-I$//')
# Prepend the branch name to the commit message
echo "$BRANCH_NAME $(cat "$1")" > "$1"
fi
Activity