We are using github, and most of us are using github desktop to manage our branches and commits. We are having an issue where commits are getting overwritten but leaving no history. Example: person A will make a change to a file in their own branch, create a PR, and get it merged into our main branch. Person B will make a different change to the same file in their own branch, create a PR, and get it merged into our main branch. The changes from person A will go missing after person B's PR merges into our main branch. Looking at the commit history will show person A made a change, and then person B made a different change, but in the history for person B, which is after person A it does not show them undoing person A's changes, but the file at that time does not contain person A's changes. We aren't sure why this is happening and not leaving any history, any one have an idea?
Edit: I made a video of the commit history of one of the issues here: vimeo.com/905744582 initially on line 45 I changed 6 to 63, the commit after mine added a line above that and you'll notice it is back to 6.
The most likely explanation in my opinion is in how merge conflicts were resolved.
By default, git show -p
won't show you the changes in a merge commit, but you can change that with --diff-merges
.
Try
git show -p <sha-of-merge-commit> --diff-merges=separate
using the SHA of person B's merge commit.
In the output, you should see two sections each starting with commit <merge-sha> (from <parent-sha>)
. Inspect those carefully to see if it's during the merge itself that person A's work was removed.
If so, the problem is related to how Person B actually merged that PR.