自定义git日志

时间:2015-04-10 10:52:26

标签: git

我目前有一个特定git log命令的以下别名:

alias.lol=log --graph --decorate --pretty=oneline --abbrev-commit --all

这会产生类似于此的输出:

* 248f98d (origin/tg-kvo) standalone recording stuff
* c8db387 test adding standalone with observers
* 348a48c standalone rlmarray kvo
* fdf2981 use normal kvo for standalone objects
* 5085dd1 test standalone
* 95a2724 test
* 88e799b stuff
* b6d8653 fallback for ignored properties
* eaf93f6 add ignored property test
* b35b73f throw on invalid removeObserver
* 9bd9701 array change info
* 0759a01 delay willchange
* e783be5 array change info
* 8455d7f Array modification tests
* a6809ff Set NSKeyValueChangeKindKey
* 3b8d90f minimal array property notifications
* 8032d9b fix tests
* 7902b0f stuff
* 718c434 kvo
* c32e8df perf

这与我想要的非常接近。但是,完美的输出将是:

* <abbrev commit> <authors email> <date, either short or relative> <as much of the commit as you can fit in the remaining space>

我试过,但漂亮=在线干扰了显示作者和日期。

无论如何都要获得此输出?

谢谢!

1 个答案:

答案 0 :(得分:2)

要格式化git日志输出,可以使用--pretty选项。 试试这个:

git log --pretty=format:"%h%x09%ae %x09%ad%x09%s" --date=short