0

I found that the file was changed, but I can't find more detailed information in the commit record。 I have tried git log -p --full-history filepath, then I got the result below:

commit c59b1cd3a918d2807ed45faf32a7e88e4b3ffc70
Merge: d88b9ab9 b21cca99
Author: someone <someone@gmail.com>
Date:   Tue Jan 3 15:59:49 2023 +0800

    someone's commit message

commit b21cca99fc39f13364a80db7c4fd086ef5cc860f
Author: me <me@gmail.com>
Date:   Fri Dec 30 17:34:15 2022 +0800

    my commit message
...
...
other commit record

"b21cca99fc39f13364a80db7c4fd086ef5cc860f" is my commit, it is ok! I can not find any change detail for the file in commit "c59b1cd3a918d2807ed45faf32a7e88e4b3ffc70".

Could anyone tell me what should I do? I'm trying to figure out what happened in the commit "c59b1cd3a918d2807ed45faf32a7e88e4b3ffc70".

fbfatboy
  • 371
  • 1
  • 6
  • From https://stackoverflow.com/a/25776548/7976758 : `git log --full-history -m -p filepath` Found in https://stackoverflow.com/search?q=%5Bgit-log%5D+merge+commit – phd Jan 03 '23 at 16:58
  • For view ing the history in a terminal (as opposed to feeding the output of `git log` to a script), I strongly advise to always add `--graph`. You will have a clearer view of what commit is a parent of what commit, of merge commits ... – LeGEC Jan 04 '23 at 06:31

1 Answers1

3

The commit you're asking about is a merge. You can tell from the line

Merge: d88b9ab9 b21cca99

This means that in a sense, it doesn't introduce any changes - since all the changes were already present in one of its parents (just not both).

Try something like

git show --diff-merges=separate c59b1cd3 -- filepath

to make it clear which parent introduced which change (and note that this limits it to the file you're interested in)


In general, it's probably faster to just run

git blame filepath

to see the annotated version, instead of running log and then digging into each commit.

Useless
  • 64,155
  • 6
  • 88
  • 132