小编Bot*_*cco的帖子

如何使git log输出仅在一行上显示日期和哈希?

我需要获取Date并以这种格式提交一组github的结果:

Date Commit
19 Mar 2015 b6959eafe0df6031485509c539e22eaf2780919c
1 Apr 2015 9a1f13339cc7d43930440c2350ea3060b72c8503
1 Apr 2015 1e76036421ca4d72c371182fc494af514911b099
Run Code Online (Sandbox Code Playgroud)

我可以使用以下命令获取日期:

git log | grep Date: | awk '{print  $4 " " $3 " " $6}'
Run Code Online (Sandbox Code Playgroud)

和提交

git log | grep commit | awk '{print $2}'
Run Code Online (Sandbox Code Playgroud)

如何合并命令,以便在同一行中打印两个结果?

这是git日志的示例:

commit 1e76036421ca4d72c371182fc494af514911b099
Author: xxxx
Date:   Wed Apr 1 17:35:36 2015 +0200

    First web app commit

    First web app commit

commit 9a1f13339cc7d43930440c2350ea3060b72c8503
Author: xxxx
Date:   Wed Apr 1 17:28:42 2015 +0200

   change from app to website

commit b6959eafe0df6031485509c539e22eaf2780919c …
Run Code Online (Sandbox Code Playgroud)

git git-log

4
推荐指数
1
解决办法
1110
查看次数

标签 统计

git ×1

git-log ×1