Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pasos para establecer la rama de git en los commits automáticamente #6

Open
deltecacarrasco opened this issue Feb 6, 2024 · 0 comments

Comments

@deltecacarrasco
Copy link

deltecacarrasco commented Feb 6, 2024

(toca hacerlo por cada proyecto clonado, ergo por cada directorio .git)

  1. crear git hook
touch .git/hooks/prepare-commit-msg
  1. dar permisos de ejecución
chmod +x .git/hooks/prepare-commit-msg
  1. editar archivo de hook
vim .git/hooks/prepare-commit-msg
  1. 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant