carloscuesta / gitmoji

An emoji guide for your commit messages. 😜
https://gitmoji.dev
MIT License
15.63k stars 799 forks source link

✨(πŸ“): Gitmoji conventionnal commits (draft) #442

Closed Lyokolux closed 2 years ago

Lyokolux commented 4 years ago

Hello all,

here is only a reflexion about creating a convention for commit messages using Gitmoji.

This should not be included in the gitmoji project; but should serve as help for people who wants to use gitmoji in a team. This is then a draft of how to use them well or at least a way to sort the gitmojis. Not all the gitmojis are included btw.

Motivation for a convention

The only problem is that gitmojis are not supported everywhere and thus, should be used when every members can read them.

Convention

The [Angular commit convention]() follow this rule <type>(<scope>): <subject> and have proven that it works well. Gitmoji can match nearly this case: <type> can be replaced by <action>. "action" matches better the gitmoji definitions on the website.

At least one gitmoji must be used for each commit

Sorting the gitmojis

Action (What ?)

action (related to) Gitmojis
the code :art:, :zap:, :bug:, :ambulance:, :sparkles:, :rotating_light:, :recycle:, :wrench:, :alien:,:bulb:, :speech_balloon:,:busts_in_silhouette:, :children_crossing:, :building_construction:,:clown_face:, :camera_flash:, :label:, :goal_net:, :wastebasket:
Git / Version Control System :tada:, :bookmark:, :rewind:, :twisted_rightwards_arrows:
the project strucure :fire:, :pencil:, :rocket:, :lock:, :green_heart:, :construction_worker:, :chart_with_upwards_trend:, :heavy_plus_sign:, :heavy_minus_sign:, :package:, :truck:, :page_facing_up:, :bento:, :see_no_evil:

Scope (Where ?)

specific scope on Gitmojis
part of the code :construction_worker:, :seedling:, :lipstick:, :card_file_box:
OS :apple:, :penguin:, :checkered_flag:, :robot:, :green_apple:
technologies :whale:, :wheel_of_dharma:, ...
user :iphone:, ...

Outsider

:hankey:, :beers:, :ok_hand:, ... but always funny to use

Translating the Angular convention

Angular types possible Gitmoji(s)
feat :sparkles:, :wheelchair:, :children_crossing:, ...
fix :bug:
docs :pencil:
style :rotating_light:, :art:
refactor :recycle:
test :white_check_mark:
chore :truck:, :fire:, :package:, :arrow_down:, :arrow_up:, :alien:, :pushpin:, :bookmark: ...

Examples

:clown_face:(idGenerator.ts): add mocks

:see_no_evil: ignore the dist directory

:camera_flash:(home.vue)

:label:(interfaces.ts): add type definition for EmojiReponse

:truck: id_generator.ts β†’ IdGenerator.ts

:twisted_rightwards_arrows: feat/api-v1 β†’ master

:twisted_rightwards_arrows: feat/api-v1 into master

:fire:(eslintrc.json): duplicate with eslintrc.js

:rotating_light:(store.ts)

:recycle:(:card_file_box:) : rename the field "age" in the table USER

Comments

As the new issue #435 is related, the project is defining emojis without specific goal. Some comments in the issue explain well how the gitmojis can be used. I think Gitmoji should be neutral (such as a dictionary; without opinion) and let people decide how to use the emojis.

Some gitmojis indicate implicitly the scope such as :heavy_plus_sign: or :see_no_evil:. Some provide the action and the scope such as :green_heart:

A placeholder for the effect of the commit on the project can be added too. I think specifically about the :boom: I don't use it and might be used at the end of the commit message ?

With this commit message pattern, some Gitmojis are ambiguous such as :wrench:. It does not provide a clear where, nor an clear action and mix both where and action and does not fit. They should be kept in Gitmoji but excluded in use for this convention.

Using more than one emojis make the message less readable IMHO; so using emojis for scope makes the commit harder to read. It is a possibility however. It opens the way to new gitmojis such as #321

This can be seemed as overkill and gitmojis should be kept simple anyway ! Maybe this is too much ?

So what do you think of it ? Is it to throw away; or to be improved and how ? I hope it makes the emojis less chaotic :)

johannchopin commented 4 years ago

I really really love the idea of having a convention for gitmojis. Not one to be followed to the letter, but at least one attempt to orient the user.

IMHO there should be no scope gitmojis in the convention because that would mean adding a lot of emoji for all the scopes (Work about oracle, Work about nginx, ...), which would be overkill (see #435).

Adding a scope, which is mostly a filename file, don't seems to make sense to me. Rarely is there only one file that is modified by commit. If there is multiple files, what would the scope looks like? Something like that?

🏷️(interfaces.ts, interface2.ts): add type definition for EmojiReponse

Commit message is then really hard to read in this case.

Moreover the scope (all the files) is already store in the commit itself and so this information is redundant.

I love the simple structure already mentionned by @carloscuesta in https://github.com/carloscuesta/gitmoji/issues/345#issuecomment-541311170:

<gitmoji> <comment>

- πŸ› #231
- 🚨 Use CamelCase
Lyokolux commented 4 years ago

having a convention for gitmojis. Not one to be followed to the letter, but at least one attempt to orient the user.

The main idea is to say : "Hey there is a practical way to use the gitmojis: see"

IMHO there should be no scope gitmojis in the convention because that would mean adding a lot of emoji for all the scopes (Work about oracle, Work about nginx, ...), which would be overkill (see #435).

The convention would only be a practical way to use the gitmojis. I think the scope must be product independant (not "Work on oracle" nor "Work on MySQL" but "Work on database" for example). As the gitmoji list is growing, I point out here that the scope can now be a gitmoji and some gitmojis indicate a scope. The convention should be a reference only and thus let the user free to use : gitmoji scope, abstract portion of the project or filename or nothing. As a new user comes in, it feels overwehlming to choose between :card_file_box: or :recycle: ; because both can match if I change the algorithm in the DB (Redis for example). How to choose if I only want one emoji because two is toom much ?

If there is multiple files, what would the scope looks like?

Good point : I did not explained it but the scope with filename should be limited to one file. This rule pushes to write atomic commit. If more than one file is included; then it would be better to name an abstract portion of the project. (convention updated)

carloscuesta commented 4 years ago

Related with #429

bruxisma commented 2 years ago

Hi,

I know it's been a while since this issue was last updated. I was wondering if moving forward with this is still planned? Having a convention commit format for gitmoji would definitely save me a ton of headaches when trying to deal with all the tooling out there that expects conventional commits these days. πŸ˜…

At the moment I'm shoving multiple shims in everywhere or writing custom regex to convert between gitmoji and conventional commits. I'd prefer to stay with gitmoji over cc, but... it's getting harder as time goes on 😬

vhoyer commented 2 years ago

yeah, that is a good point

EDIT: possibly gitmoji could fall in disuse due to this very reason

Lyokolux commented 2 years ago

EDIT: possibly gitmoji could fall in disuse due to this very reason

@vhoyer good point ! So it should definitely be an example of usage :) Surely not a convention, but an example of usage, so people can get to the point with emojis in commit message.

carloscuesta commented 2 years ago

Hey! Let's move forward with this idea!

I'll start suggesting something like this so we can start discussing about the different options:

<intention> <message>

What do you think?

carloscuesta commented 2 years ago

Hey! Sure let's move forward with this idea!

I'll start suggesting something like this so we can start discussing about the different options:

<intention> <message>

What do you think?

bruxisma commented 2 years ago

Kind of spitballing/stream of consciousness here:

Looking at the various formats for conventional-changelog, there is the older atom format (thought no longer used as of recent commit messages).

I've been doing the <intention> <message> approach to commits for some time now, however the issue that arises is "how to map these intentions to something for a conventional-commits changelog" or "how to declare scope for a given change". Instead of β™» Refactor module X of of package Y <explanation of change here>, the angular commit format would looks like refactor(package.module): <message>, which seriously cuts down on the "recommended" 50 columns for a commit message rule (even the default vim highlighting for gitcommit marks text as "red" past 50 characters).

I think adopting a <scope> as an optional setting (it is optional according to the conventional commit spec) would be perfectly fine as an addition, though explicitly stating that <scope> itself should not be a gitmoji would make sense.

carloscuesta commented 2 years ago

I think adopting a as an optional setting (it is optional according to the conventional commit spec) would be perfectly fine as an addition, though explicitly stating that itself should not be a gitmoji would make sense.

I'm not a big fan of the scope thing but I see the value in some scenarios, let's include it as well in the convention:

<intention> [scope?] <message>

Being:

bruxisma commented 2 years ago

I'm in favor of this.

This would also be mostly compatible with Gitmoji + Jira Smart Commits (which I use at work and has been adopted by several coworkers). The difference here is that I think it should be

<intention> [scope?][:?] <message>

So that : can be filtered out by tooling and not counted as part of the scope, but as an optional separator.

EDIT:

one addendum: there should be something to signify what is a scope, and what is part of a message as some kind of required separator for when the scope is present, otherwise it will make tooling difficult in some situations πŸ˜…

carloscuesta commented 2 years ago

Hey! I think that adding the separator optionally if you want to specify the scope is a great addition, let's go with:

<intention> [scope?][:?] <message>

Anyone has other ideas/opinions? πŸ‘€

vhoyer commented 2 years ago

personally I always use [] to separate the scope, examples:

:bug: [zsh] move when the local zshrc file is loaded (earlier) :children_crossing: [nvim] add makeprg to generate ctags for ruby :sparkles: [git] allow revert-menu to receive an arg with how many commits to add to the revert menu

that's from my dotfiles repo :D

carloscuesta commented 2 years ago

I think we can move forward with the approach agreed on https://github.com/carloscuesta/gitmoji/issues/442#issuecomment-1059802990, let's include this on the website and the readme under a "example of usage"