Branches and commits
This standard defines how branches are named and how commit messages are written in Crehana's repositories.
Branch name
Every branch follows this structure:
Examples:
Commit message
Every commit includes the Jira ticket code and a brief description. The format is mandatory:
Examples:
Merging to main
When merging to main or master, squash the commits so the history stays as readable as possible.
Automate the ticket ID with a hook
The prepare-commit-msg hook extracts the ticket ID from the branch name and prepends it to the commit message, so you don't type it on every commit. Set it up in each repository you work on.
-
Create the hook file, with no extension:
-
Paste this script. It uses the macOS
sedsyntax (sed -i ''), so it applies to Mac only: -
Make it executable:
Verification
On a branch named HRIS-1234-validacion-email, make a commit with the message feat agrega validación de email. You should see the ID prepended:
Related
- Branching model — the full Git flow

