Tag in Git commit summary?

1.5k Views Asked by At

Do people use tags in commit in the one line commit summary?

Are there any standard tags or commonly used tags?

Git has supports for "tags" but it seems to mostly be used for tagging versions like "v1.8.5-rc1". By "tag" I don't mean that to tag a commit or a branch like "v1.8.5-rc1" for example.

MediaWiki can tag edits as minor signified by m, and bot edits by b.

Do people put tags in commit message?

Example:

[trivial] Add 'foo()' method to 'Bar' class
[minor] Add 'foo()' method to 'Bar' class
[wip] Add 'foo()' method to 'Bar' class
  • Do people use tags such as this?
  • Is it common practice?
  • Are these called tags, or what are these called?
  • Are there any standard tags?
  • Are there any commonly used tags?
  • What tags are in common use?
  • What is the syntax, is it a word enclosed in square brackets?
1

There are 1 best solutions below

0
On BEST ANSWER

Git commit message conventions are multiple.
Everything depends on what you want to do with it.

I would say that name for this is simply "commit message convention" or more precisely for your use case "commit message labeling".

One is the Angular convention, that use "type" which is one of:

  • feat (feature)
  • fix (bug fix)
  • docs (documentation)
  • style (formatting, missing semi colons, …)
  • refactor
  • test (when adding missing tests)
  • chore (maintain)

Some other use different/more types, and even emoji to add commit info in message.

It's up to you to define your own commit message convention (or use an existing one).
If you want to generate a changelog from commit messages, convention must be well defined and format must allow automatic parsing


As you discovered, git "tag" notion is totally different and is a way to name a specific commit, mostly used for releases.


BTW, there are some bad practices in your example: - "WIP" notion should be in a branch - Commit message should answer the question "Why?" not "What?" (the git diff already give this information. Take a look at "A Note About Git Commit Messages"