git日志输出如svn ls -v [英] git log output like svn ls -v

查看:89
本文介绍了git日志输出如svn ls -v的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让git像svn ls -v那样给我输出。基本上是每个文件和谁最后编辑该文件的列表?像这样:

  filea.txt其他人
fileb.txt另一个人

也许即使使用SHA来识别发生变化的提交?

解决方案

在git中问这个问题并不是一个很自然的问题,但是你可以用类似的东西实现你想要的东西。

 为$(ls); git log --pretty = format:%h%x09%an%x09%ad%x09 $ a-1  - $ a;完成

这会遍历当前目录中的每个文件并执行 git log $ b

这并不是非常有效,因为它会为每个文件搜索git历史记录,并使其没有努力重复使用先前搜索的结果。然而,这是一条线。

Is there a way to make git give me output like svn ls -v does. Basically a list of each file and who last edited that file? Like this:

filea.txt     Someone Else
fileb.txt     Another Person

Maybe even with the SHA to identify the commit the change happened in?

解决方案

It's not a very natural question to ask in git, but you can probably achieve something like what you want with something like this.

for a in $(ls); do git log --pretty=format:"%h%x09%an%x09%ad%x09$a" -1 -- "$a"; done

This goes through each file in the current directory and performs a git log on it to find the last commit to have affected it.

It's not very efficient, as it searches the git history for each file and makes no effort to reuse the results of previous searches. It is, however, a one-liner.

这篇关于git日志输出如svn ls -v的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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