我已经暂存了一个文件readme.txt
。调用时
$ git commit
它会打开我的编辑器并显示一条预定义的消息(|
在第一行中,我添加的只是为了强制 stackoverflow 显示此空行):
|
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
# Changes to be committed:
# modified: readme.txt
#
# Untracked files:
# message.txt
#
这样我就可以输入消息
add readme.txt
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
# Changes to be committed:
# modified: readme.txt
#
# Untracked files:
# message.txt
#
保存并退出,将使用消息创建提交add readme.txt
.
但是,当文件中有相同内容时message.txt
(包括#
线)并运行
$ git commit --file message.txt
提交将包含文件的完整内容作为消息,包括所有注释。
如何告诉 Git 忽略#
指定消息文件中的行与没有--file <message-file>
范围?
那么这将是
git stripspace --strip-comments < message.txt |
git commit --file -
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)