为什么git使用--follow和--reverse记录只返回最后一次提交? [英] Why does git log with --follow and --reverse return only last commit?

查看:113
本文介绍了为什么git使用--follow和--reverse记录只返回最后一次提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从一开始就查看文件的所有提交,反转
我跑了

  git log --reverse [file] 

它按预期工作。
,但是对于一个重命名的文件,它只显示从它重命名的提交中显示,所以我添加了 - 关注它。

  git log --reverse --follow [file] 

但它现在只显示最后一个这是为该文件完成的。



我怎样才能将两者结合起来以获得所需的结果。

解决方案

这似乎是 git中的已知错误。我能看到的唯一工作就是如果你知道文件之前被命名了什么,将它与当前文件一起传递给命令,即

  git log --reverse --follow  -  oldfilename currentfilename 

编辑:

以下将做你想做的:

  git log --name-only --pretty =format: --follow< filename> | sort -u | xargs git log --reverse  -  


I wanted to view all the commits of a file from the beginning in reverse I ran

git log --reverse [file]

And it worked as expected. but for a renamed file it shows only from the commit in which it was renamed so I added --follow in it.

git log --reverse --follow [file]

but it now shows only the last commit which was done for that file.

How can I combine both to get the desired result.

解决方案

This seems to be known bug in git. The only work around I can see is if you know what the file was named before, pass it along with the current file to the command, i.e.

 git log --reverse --follow -- oldfilename currentfilename

Edit: the following will do what you want:

git log --name-only --pretty="format:"  --follow <filename> | sort -u | xargs git log --reverse --

这篇关于为什么git使用--follow和--reverse记录只返回最后一次提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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