Two Different Commits Show the Same Changes on the Same Branch

This may just be due to my own ignorance about Git and/or GitLab, but I am seeing something odd on a particular branch in our repository and I haven’t been able to figure out why.

We have a development branch which we have introduced a good number (100+) of commits to and plan to merge into our production branch soon. However, I have noticed at least two commits which appear to have the same changes. They are two separate commits with separate parents, but one is the result of a Merge Request (with squashed commits) and the other appears to be a regular commit.

This doesn’t appear to affect the code that would be going into the Production branch, but it seems odd that two commits would both show the same code being added to line 94 of a given file, for example. My understanding of Git is that the subsequent commit should not have anything to add, since the line was already added in the preceding commit.

We interact with GitLab via a 3rd party application, Looker, which provides Git functionality via an IDE. Not sure if this may be part of why we are seeing odd behavior.

It shakes my confidence in the integrity of the branch without knowing more :sweat_smile: so hoping to get a better understanding of why this might happen, whether it’s an issue, and how it may be avoided in the future.

Does anyone else have experience with this or something similar?

The answer here is actually pretty simple. We started squashing commits on merges recently and this squashed commit (mentioned above) is the first commit while the Merge Commit is the second. While it makes a branch history more difficult to read, it is no longer a concern of ours.