DEV Community

Discussion on: How to write a good commit message

Collapse
 
suckup_de profile image
Lars Moelleken

You can share your git commit conventions in the team via e.g.:

add this into your "~/.gitconfig"-file

[commit]
  template = ~/.gitmessage

example: github.com/voku/dotfiles/blob/mast...

Collapse
 
wdhowe profile image
wdhowe

We store a file in the root of each project: .gitmessage

Then in the project's Contributing section in the Readme, we have:

Before contributing to this project, configure the commit template while in the project root:

git config commit.template .gitmessage

The contents of the gitmessage is:
jira/issue-####: Title of issue
Description of changes.

We then squash all commits on merge and enforce rebasing.

This makes for a very clean commit log like:

jira/issue-2: Do that
These are more changes.

jira/issue-1: Do this
These are the changes.

Collapse
 
suckup_de profile image
Lars Moelleken

How do you enforce rebasing?

Thread Thread
 
wdhowe profile image
wdhowe

It's a setting in GitLab per project.

Settings > General > Merge Requests.
Under Merge method, select "Fast-forward merge".

Description is: "No merge commits are created. Fast-forward merges only. When conflicts arise the user is given the option to rebase."