Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to automatically add a prefix to commit messages?

Tags:

git

Is it possible to define a global prefix for all the commit messages relating to a specific repository ?

like image 348
Sebastian Boldt Avatar asked Mar 05 '15 10:03

Sebastian Boldt


People also ask

How do I add a new line to a commit message?

- Fixed a bug Another method of adding a multi-line Git commit message is using quotes with your message, though it depends on your shell's capacity. To do this, add single or double quotes before typing the message, keep pressing enter and writing the next line, and finally close the quote at end of the message.

How do I change my initial commit message?

Changing the latest Git commit message If the message to be changed is for the latest commit to the repository, then the following commands are to be executed: git commit --amend -m "New message" git push --force repository-name branch-name.

What is the command to commit code with the message?

The easiest way to create a Git commit with a message is to execute “git commit” with the “-m” option followed by your commit message.


1 Answers

You can use the commit.template setting as discussed here

$ git config commit.template /path/to/git-commit-template.txt

This will set the template for the current repository only. You can add the --global flag to apply to all repositories.

like image 135
rmorrin Avatar answered Oct 15 '22 02:10

rmorrin