Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Git commit messages

Discussion in 'Open Projects' started by Aspekt1024, Oct 4, 2020.

  1. Aspekt1024

    Aspekt1024

    Joined:
    Sep 29, 2016
    Posts:
    12
    Hey, I think it might be beneficial to have some guidelines around commit messages. I've seen a few commits on this project that have commit messages akin to "added code" rather than explaining what the commit contains.

    For example, when updating a prefab (e.g. forgetting to add before pushing code changes), something along the lines of "updated <prefabName> prefab to change <attributeName> attribute field" is more meaningful than "oops". Even without the autogenerated prefab/unity object code being nigh impossible to read in git, good commit messages give context about what to expect and help understand the changes made.

    I found this blog post really useful in constructing meaninful commit messages:
    https://chris.beams.io/posts/git-commit/

    While I don't think it completely necessary to have full subject-body commit notes, at the very least having a meaningful commit subject line should be encouraged. What does everyone think?
     
    dubuu_ and indexhever like this.
  2. MileyUnity

    MileyUnity

    Unity Technologies

    Joined:
    Jan 3, 2020
    Posts:
    92
    It would be better to have proper commit messages yeah, that way you can track back what happened and why without having to search for the old PR for that. @cirocontinisio maybe this should be part of the style-guide in some way?
     
  3. indexhever

    indexhever

    Joined:
    Mar 30, 2012
    Posts:
    6
    I agree with @Aspekt1024. I would also add the card code to the commit message. But I don't know if there is some code we can relate to a task card in Codecks, something like issues code from Github?
     
    Proryanator likes this.
  4. Proryanator

    Proryanator

    Joined:
    Sep 22, 2013
    Posts:
    29
    Kind of how JIRA will connect that you made a PR for a story?

    That would be neat actually!
     
    indexhever likes this.
  5. Erenquin

    Erenquin

    Joined:
    Apr 9, 2018
    Posts:
    164
    I have a colleague who refuses PR if the commit message does not respect some format or does not give some information.
    Also I know with Git there is a possibility to enforce a certain format. It will refuse a commit if it does not follow this format (but it is tricky to put in place and I think it can be checked only a push time, not actually commit time).

    Not going to these extemes, I think we should at least put the Codecks ticket number in the commit message.
     
    Proryanator likes this.
  6. MileyUnity

    MileyUnity

    Unity Technologies

    Joined:
    Jan 3, 2020
    Posts:
    92
    dubuu_ likes this.