# Automatically add ticket ID to every commit message in Git

DevFeed: [Automatically add ticket ID to every commit message in Git](<https://devfeed.tech/articles/automatically-add-ticket-id-to-every-commit-message-in-git-27667.md>)

Original publisher: [Read original article](<https://gagor.pro/2021/11/automatically-add-ticket-id-to-every-commit-message-in-git/>)

Author: Tom

Published: 2021-11-09T00:00:00Z

Content type: tutorial

Language: en

Sources: [Tomasz Gągor](<https://devfeed.tech/sources/tomasz-gagor.md>)

Topics: [Git](<https://devfeed.tech/topics/git.md>), [Automation](<https://devfeed.tech/topics/automation.md>)

Tags: [add-ticket-id-to-commit](<https://devfeed.tech/tags/add-ticket-id-to-commit.md>), [automation](<https://devfeed.tech/tags/automation.md>), [bash](<https://devfeed.tech/tags/bash.md>), [commit](<https://devfeed.tech/tags/commit.md>), [commit-message-best-practices](<https://devfeed.tech/tags/commit-message-best-practices.md>), [git](<https://devfeed.tech/tags/git.md>), [git-aliases](<https://devfeed.tech/tags/git-aliases.md>), [git-automation](<https://devfeed.tech/tags/git-automation.md>), [git-commit-message](<https://devfeed.tech/tags/git-commit-message.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [jira-integration](<https://devfeed.tech/tags/jira-integration.md>), [linux](<https://devfeed.tech/tags/linux.md>), [macos](<https://devfeed.tech/tags/macos.md>)

## AI overview

A tutorial explains how to use custom Git aliases to read a ticket ID from the branch name and automatically prefix commit messages with it. Commits fail when no ticket ID is available.

## Source excerpt

Learn how to automatically add ticket IDs to every commit message in Git, ensuring consistent and informative commit history by using custom Git aliases.