zoukankan      html  css  js  c++  java
  • Github的commit规范

    参考链接:GIT写出好的 commit message

    基本要求

    • 第一行应该少于50个字。 随后是一个空行 第一行题目也可以写成:Fix issue #8976
    • 永远不在 git commit 上增加 -m <msg> 或 --message=<msg> 参数,而单独写提交信息
    • 一个不好的例子 git commit -m "Fix login bug"

    一个推荐的 commit message 应该是这样:

    Redirect user to the requested page after login
    
    https://trello.com/path/to/relevant/card
    
    Users were being redirected to the home page after login, which is less
    useful than redirecting to the page they had originally requested before
    being redirected to the login form.
    
    * Store requested path in a session variable
    * Redirect to the stored location after successfully logging in the user
    • 注释最好包含一个连接指向你们项目的 issue/story/card。一个完整的连接比一个 issue numbers 更好
    • 提交信息中包含一个简短的故事,能让别人更容易理解你的项目

    小提示

    • 使用 fixaddchange 而不是 fixedaddedchanged
    • 永远别忘了第2行是空行
    • 用 Line break 来分割提交信息,让它在某些软件里面更容易读
    • 请将每次提交限定于完成一次逻辑功能。并且可能的话,适当地分解为多次小更新,以便每次小型提交都更易于理解。
    常用type:

    feat:新功能(feature)
    update:更新
    change:修改 fix:修补bug docs:文档(documentation) style: 格式(不影响代码运行的变动) refactor:重构(即不是新增功能,也不是修改bug的代码变动) test:增加测试 chore:构建过程或辅助工具的变动

    例子:

    Fix bug where user can't signup.
    
    [Bug #2873942]
    
    Users were unable to register if they hadn't visited the plans
    and pricing page because we expected that tracking
    information to exist for the logs we create after a user
    signs up.  I fixed this by adding a check to the logger
    to ensure that if that information was not available
    we weren't trying to write it.
    推荐格式:
            头部(描述更新的内容)
            //空行
            内容详细描述
            //空行
            尾部(加上部分注解等)    
  • 相关阅读:
    [WM]谁抢走了应用程序的性能?
    只有更烂的程序员
    [WM]n久以前写的ConnMgr类
    [WM][转]PPC中如何找到正在使用中的网络(源代码)
    让IE6支持minwidth和maxwidth的方法(JS实现) + (CSS实现)
    jQuery tab 切换函数
    wap、3g手机的端的网页头部
    复制到系统剪贴板之IE,ff兼容版
    鼠标滑过展开,js版和jquery版
    JS+CSS实现网页滚动条美化
  • 原文地址:https://www.cnblogs.com/forfly/p/7640669.html
Copyright © 2011-2022 走看看