There are changes in Git's history, but the final result is wrong. What could be the reason?

the real file is too large, so the simplification goes something like this:

version 0: there is a file a.txt , in which there is a more characteristic line. This is the only place in the whole file, and there is no repetition. Suppose it is old

.

version 1: someone in this commit has changed old to new

version 2 (final version): in this file, old is still old .

the three versions here are just examples. In fact, the commit is far away from many individual commit, and is not a single branch, there are a variety of merge operations.

I want to figure out why the changes to version 1 are not included in version 2, so git log-p a.txt > > log.txt , then look for old in the log.txt file, and only one change can be found:

- old
+ new

and one of the earliest additions:

+ old

that is, what has been modified in a commit is not reflected in the final file

what are the possible reasons for this situation and how to investigate it?

Git
Oct.29,2021

try using gui to check it out.
gitk path / file name

Or use git blame to see where old came from.

Menu