简体   繁体   English

没有提交消息的git日志补丁

[英]git log patch without commit message

I am using 'git log -p' to get the git patches.我正在使用 'git log -p' 来获取 git 补丁。 How to print the patch without the commit messages.如何在没有提交消息的情况下打印补丁。

Author: abc
Date:   Tue Apr 1 23:46:39 2013 +0000
  I don't want commit message

diff --git 
..............
...........
--- /dev/null
+++

Expected:预期的:

Date:   Tue Apr 1 23:46:39 2013 +0000

diff --git 
..............
...........
--- /dev/null
+++

You can use something like git log -p --pretty='format:Date: %aD%n' to specify a pretty format that includes just the date.您可以使用诸如git log -p --pretty='format:Date: %aD%n'来指定仅包含日期的漂亮格式。 If you also want the object ID, you can write git log -p --pretty='format:commit %H%nDate: %aD%n'如果你还想要对象 ID,你可以写git log -p --pretty='format:commit %H%nDate: %aD%n'

If you're only interested in processing a single patch, you can also use the following如果你只对处理单个补丁感兴趣,你也可以使用以下

git format-patch --stdout HEAD^..HEAD | sed -n '/^Date:/p;/^diff --git/,$p'

You can do more advanced things with Perl or Ruby instead of sed if you want, which will allow you to process more patches.如果需要,您可以使用 Perl 或 Ruby 而不是 sed 来做更高级的事情,这将允许您处理更多补丁。

git log -p --format=

displays the patch without any part of the commit message.显示没有提交消息任何部分的补丁。 Similar to: https://stackoverflow.com/a/40837380/1959808类似于: https : //stackoverflow.com/a/40837380/1959808

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM