Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

A Useful Template for Commit Messages

DZone's Guide to

A Useful Template for Commit Messages

A useful heuristic for writing better commit messages to effectively communicate code changes within your team.

· DevOps Zone ·
Free Resource

Learn how integrating security into DevOps to deliver "DevSecOps" requires changing mindsets, processes and technology.

Here's a useful heuristic for writing better commit messages. Set your commit message template to:

# If applied, this commit will...

# Explain why this change is being made

# Provide links to any relevant tickets, articles or other resources

and you'll be guided into writing concise commit subjects in the imperative mood - a good practice. See rule 5 of Chris Beam's "How to write a commit message" for the inspiration of this tip and more reasoning on the use of the imperative mood.

To do this in Git, save the above content in a file (eg ~/.git_commit_msg.txt) and run:

$ git config --global commit.template ~/.git_commit_msg.txt

Here's what this looks like in practice:

/static/images/git-commit-snap.png

Try it - it's genuinely useful.

Learn how enterprises are using tools to automate security in their DevOps toolchain with these DevSecOps Reference Architectures.

Topics:
git ,commit ,template

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}