Questions about conventional commit messages in git
Asked Answered
I

2

15

I'm trying to adapt to conventional commit messages, described in this article.

Here's a snippet from the article:

Allowed <type> values:

feat (new feature)
fix (bug fix)
docs (changes to documentation)
style (formatting, missing semi colons, etc; no code change)
refactor (refactoring production code)
test (adding missing tests, refactoring tests; no production code change)
chore (updating grunt tasks etc; no production code change)

But sometimes there are changes w/c are hard to categorize into this types. I'll list some of changes w/c i find confusing on what type to use

What types should i use in this cases

  1. I added a css style on an existing component(react, angular, vue, etc)
  2. I edited configuration files in my project such as package.json, .prettierc, etc.
  3. Renaming a file
  4. Deleting a file
Intensity answered 17/4, 2020 at 0:44 Comment(2)
Well, why did you add the CSS style? Did you do it to create a new feature, or to fix a bug, or...?Donatist
@NateEldredge - so that means it's a "feat" type since i only add styles and not fix some design. Ok, i get it now. It depends on the the reason you add the css. But what about renaming files, i guess it's a "refactor" type. With the config files, i think they are "chore" types. But what about deleting files? Let's say those files are no longer needed, does that means it's just a "refactor"?Intensity
H
10

Here's the more detailed conventional commit types

  • build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
  • ci: Changes to our CI configuration files and scripts (examples: CircleCi, SauceLabs)
  • docs: Documentation only changes
  • feat: A new feature
  • fix: A bug fix
  • perf: A code change that improves performance
  • refactor: A code change that neither fixes a bug nor adds a feature
  • test: Adding missing tests or correcting existing tests

For each of your questions, I've put the type I'd use under it.

I added a css style on an existing component(react, angular, vue, etc)

feat

I edited configuration files in my project such as package.json, .prettierc, etc.

build

Renaming a file

refactor, potentially add BREAKING CHANGE

Deleting a file

refactor, potentially add BREAKING CHANGE

Heliocentric answered 6/9, 2022 at 12:10 Comment(0)
C
3

What you're referring to is inspired from Angular's commit rules:

https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits

Also see:

https://github.com/commitizen/conventional-commit-types/blob/master/index.json

https://github.com/pvdlg/conventional-commit-types

I think for a few of your points, like 'deleting a file', it probably depends why you're deleting it. For example, removing a file because you've moved its in code into a more logical location - its probably a refactor.

Crossbill answered 17/4, 2020 at 9:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.