有什么办法可以在git中逐步构建提交消息? [英] Is there any way to incrementally build commit messages in git?

查看:64
本文介绍了有什么办法可以在git中逐步构建提交消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有可能逐步构建git commit消息,记录我在进行代码更改时正在做的事情:

I'm wondering if it is possible to build git commit messages incrementally, documenting what I'm doing as I make code changes:

  1. 退房并开始工作
  2. 输入提交消息标题(即摘要)
  3. 进行代码更改
  4. 更新我的提交消息以描述更改
  5. 重复3和4,直到提交准备就绪

git有内置的机制来做到这一点吗?

Is there any mechanism built into git to do this?

推荐答案

git commit可以使用-F选项从文件中获取提交消息.因此,您可以执行以下操作:

git commit can take a commit message from a file using the -F option. So, you can do something like this:

# Do some work
$ echo 'Did some work' > commit-msg.txt
# Do some more work
$ echo 'Did some more work' >> commit-msg.txt
$ git commit -F commit-msg.txt

这篇关于有什么办法可以在git中逐步构建提交消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆