Difference between git log with and without when only was changed?

后端 未结 1 1351
陌清茗
陌清茗 2021-01-29 01:25

When I have two branches that have been merged, and in each one the same change was made independently, the git log of that file shows only one of these instances, while the git

相关标签:
1条回答
  • 2021-01-29 02:00

    The answer is buried in the git rev-list documentation (this same text is included in the git log documentation but since virtually everything uses rev-list, I think it's the right place to remember as your general lookup location):

    History Simplification
    Sometimes you are only interested in parts of the history, for example the commits modifying a particular <path>. But there are two parts of History Simplification, one part is selecting the commits and the other is how to do it, as there are various strategies to simplify the history.

    The following options select the commits to be shown:

    <paths>
    Commits modifying the given <paths> are selected.

    [snip]

    The following options affect the way the simplification is performed:

    Default mode
    Simplifies the history to the simplest history explaining the final state of the tree. Simplest because it prunes some side branches if the end result is the same (i.e. merging branches with the same content)

    --full-history
    Same as the default mode, but does not prune some history

    You're using the default mode when you (presumably) want --full-history mode. Note that history simplification gets activated when you use the <paths> notation to introduce history selection: that's why you don't need --full-history without it.

    0 讨论(0)
提交回复
热议问题