Why does git log not default to git log --follow?

前端 未结 2 1474
时光说笑
时光说笑 2021-02-12 17:59

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

2条回答
  •  名媛妹妹
    2021-02-12 18:13

    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 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!

提交回复
热议问题