I am wondering if there any tools for providing a more verbose file history, especially with regard to merges where our
changes are kept. This problem is best explained with an example.
Let's say I made a conflicting change on master
and a feature
branch:
git checkout master
<made some change to file.txt>
git commit -a -m "Change on master"
git checkout -b feature
<made conflicting change to file.txt>
git commit -a -m "Change on feature"
If I merge feature
into master
and keep my changes using git checkout --ours file.txt
I get different results for file.txt
than if I were to merge master
into feature
(and then merge feature
into master
to fast forward master
). (I understand merging --ours
effectively could have also been done inadvertently with mergetool
.)
Using git log -p
in both these scenarios, the merge commits do not report any change in file.txt
, but its contents are different between the scenarios. Now file.txt
's change history has been obfuscated and it has become difficult to know which version is in master
. I can run git log -- file.txt
, but this solution doesn't scale and requires you already know what files were part of the bad merge.
If someone makes the wrong merge decision, if becomes difficult to track down which files were kept the same. Otherwise, if a merge made changes to a file, it is easy to see this.