5

I am confused about git commit message.

Here is an Angular standard doc for git commit message.There are 7 allowed types:

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

If I change a file to fix a bug and correct code style,which type should I use?Can I use two or more types at a time?

3
  • 5
    Make two commits. Commented May 23, 2017 at 9:13
  • You mean that I should make two adds and two commits? Commented May 23, 2017 at 9:18
  • 3
    It's helpful in many ways to make atomic commits. A bug fix and a style fix are different things that should be handled in different commits. Commented May 23, 2017 at 9:26

1 Answer 1

5

This answer is sort of in between a glorified comment and a full answer, as your question invites opinion.

You don't need to follow any standard when making commit messages in Git. The primary purpose of a commit message is to leave information about what happened in your commit. It is the presence of useful/helpful information which is key here, rather than some set of codes which are used. Many organizations use their own templates for commit messages. But again, it is up to you how you want to record information here.

Update:

The Angular standard codes might be helpful in a way, in that they promote making separate commits for logically different types of tasks. For example, it would loosely enforce that bug fixes, refactors, and feature additions all come in as separate commits. In this sense, a standard is useful, but what I said above about having good commit etiquette still stands; include helpful information for best results.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your answer.But if I am in an organizaton whose standard template is like what I mentioned above, how should I deal with it?
Make a fix commit then make a style commit.