git提交时的message和description

博客探讨了Git提交时message和description的区别。谷歌认为第一行可看作title,其余为description,提交时加“-m”通常只提交了title且可添加多个。Git官网建议用简短行总结更改作标题,空行后再详细描述,首空行前文本会被当作提交标题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

前言

git提交时会有两个信息可能需要填写,一个是message,一个是description,这两者的区别在哪里呢?

正文

谷歌的答案:
在这里插入图片描述
第一行可以理解为是title,其余的是description,这个定义看个人喜欢,所以一般提交时加一个"-m",其实只是提交了title,其实是可以加多个的。

再参考git的官网:

Though not required, it’s a good idea to begin the commit message with a single short (less than 50 character) line summarizing the change, followed by a blank line and then a more thorough description. The text up to the first blank line in a commit message is treated as the commit title, and that title is used throughout Git. For example, git-format-patch[1] turns a commit into email, and it uses the title on the Subject line and the rest of the commit in the body.

参考

https://stackoverflow.com/questions/16122234/how-to-commit-a-change-with-both-message-and-description-from-the-command-li
https://git-scm.com/docs/git-commit

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值