Git将输出记录到XML,JSON或YAML? [英] Git log output to XML, JSON, or YAML?

查看:258
本文介绍了Git将输出记录到XML,JSON或YAML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个非常简单的问题:作为一个Git新手,我想知道是否有办法将我的git日志输出到一个文件,最好是像XML,JSON或YAML这样的序列化格式。任何建议?

解决方案

输出到一个文件:

  git log> filename.log 

要指定一种格式,就像您希望一行中的所有内容

  git log --pretty = oneline> filename.log 

或者您希望通过像sendmail这样的程序通过电子邮件发送格式

  git log  - pretty = email | email-sending-script.sh 

生成JSON,YAML或XML就像你需要做的一样:

  git log --pretty = format:%h%x09%an%x09%广告%x09%s

这个要点(不是我的)完美地以JSON格式输出:
https://gist.github.com/1306223



另请参见:




This is a pretty simple question: as a Git newbie I was wondering if there's a way for me to output my git log to a file, preferably in some kind of serialized format like XML, JSON, or YAML. Any suggestions?

解决方案

to output to a file:

git log > filename.log

To specify a format, like you want everything on one line

git log --pretty=oneline >filename.log

or you want it a format to be emailed via a program like sendmail

git log --pretty=email |email-sending-script.sh

to generate JSON, YAML or XML it looks like you need to do something like:

git log --pretty=format:"%h%x09%an%x09%ad%x09%s"

This gist (not mine) perfectly formats output in JSON: https://gist.github.com/1306223

See also:

这篇关于Git将输出记录到XML,JSON或YAML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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