为什么git log不是默认的git log --follow? [英] Why does git log not default to git log --follow?

查看:599
本文介绍了为什么git log不是默认的git log --follow?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我们将文件移动到其他位置或将其重命名,则除非我们特别使用,否则之前的所有历史记录都会丢失在 git log git log --follow 。我认为通常情况下,预期的行为是我们希望看到过去的历史记录,而不是在重命名或移动后切断,那么为什么 git log 不会默认使用 - 遵循标志?

解决方案

推测这是因为 git log 通常用于显示整体提交历史记录,而不是单个文件或路径的历史记录。 - 关注选项仅在您查看单个文件时才有用(并且在命名多个文件时不起作用)。由于这不是最常见的情况,所以将其作为默认值添加它并没有什么意义。



如果您想让它成为您自己的默认设置,您可以总是做一个别名:

  git config --global alias.lf'log --follow'

现在您可以执行 git lf< filename>



注意:如果您想要向邮寄清单提出要求的变更,并查看人们的想法,可以请执行 此处 。或者,更好的是,您可以 提交补丁 ! p>

If we ever moved a file to a different location or renamed it, all its previous history is lost in git log, unless we specifically use git log --follow. I think usually, the expected behavior is that we'd like to see the past history too, not "cut off" after the rename or move, so is there a reason why git log doesn't default to using the --follow flag?

解决方案

Presumably it's because git log is generally used for displaying overall commit histories, and not the history of a single file or path. The --follow option is only relevant if you're looking at a single file (and doesn't work when you name more than one file). Since that's not the most common case, it doesn't really make sense to add it as the default.

If you want to make it a default for yourself, you can always make an alias:

git config --global alias.lf 'log --follow'

Now you can do git lf <filename> to get the behavior you want.

Note: If you want to propose the change you're asking for to the mailing list and see what people think, you can do that here. Or, even better, you could submit a patch!

这篇关于为什么git log不是默认的git log --follow?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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