V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
MajestySolor
V2EX  ›  问与答

git commit -m 如何让 message 显示为一个标题和一段描述?

  •  
  •   MajestySolor · 2014-11-15 09:33:20 +08:00 · 5363 次点击
    这是一个创建于 3464 天前的主题,其中的信息可能已经有所发展或是发生改变。
    git commit -m 只能加一句message,如何做到像github网页上那样提交一个commit可以写一个标题和一段描述,对应的命令行参数是什么?帮助手册看过了,没有能实现类似功能的参数啊?
    13 条回复    2014-11-15 15:28:39 +08:00
    jacob
        1
    jacob  
       2014-11-15 09:38:09 +08:00
    不加-m就能了- -.
    kfll
        2
    kfll  
       2014-11-15 09:38:47 +08:00 via Android
    -e 进入编辑器模式
    mahone3297
        3
    mahone3297  
       2014-11-15 09:39:39 +08:00
    从来不加-m的飘过。。。
    还可以加上-v。。。
    song940
        4
    song940  
       2014-11-15 09:45:44 +08:00 via iPhone
    git commit -v

    首行为标题,次行开始描述。
    xhacker
        5
    xhacker  
       2014-11-15 10:17:26 +08:00
    git commit -m "Title" -m "Content"
    thuai
        6
    thuai  
       2014-11-15 10:19:25 +08:00
    @jacob
    @mahone3297
    @song940
    git commit -v "Title description"
    这样写么?
    laputaprince
        7
    laputaprince  
       2014-11-15 10:25:12 +08:00
    git commit -m "Title" -m "Description ..........";

    lz是nyu的么。
    9hills
        8
    9hills  
       2014-11-15 10:25:45 +08:00
    git commit 直接回车
    krafttuc
        9
    krafttuc  
       2014-11-15 10:50:55 +08:00 via iPhone
    git commit
    mahone3297
        10
    mahone3297  
       2014-11-15 12:04:02 +08:00
    @thuai git commit -v 回车。
    然后你就可以看到编辑页面
    单行超过80字符,字符颜色还会变,很有趣。
    huangfuyingjian
        11
    huangfuyingjian  
       2014-11-15 13:57:07 +08:00 via iPhone
    @mahone3297 谢!
    yukirock
        12
    yukirock  
       2014-11-15 15:12:49 +08:00
    @mahone3297

    > 单行超过80字符,字符颜色还会变,很有趣。

    git commit 會打開編輯器來編輯 commit message,所以這個效果只是默認編輯器的默認設置,除非你自己設置過。跟 git 沒有關係。
    mahone3297
        13
    mahone3297  
       2014-11-15 15:28:39 +08:00
    @yukirock 真的吗?我看git的书的时候,看到好像是说是git的功能。
    你这么一说,我觉得,好像也合理。。。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3217 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 12:44 · PVG 20:44 · LAX 05:44 · JFK 08:44
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.