After I merged a feature branch into develop, the statistics benefitted me and disadvantaged my co-worker/I got all the line inserts and removes. I think the reason is that I squash merged it, which is why all the changes are attributed to the merge-commit, why I made.
Is there anyway to get the correct statistics from git quick-stats or any other source? (GitHub has the same problem, under the contributors page)
CodePudding user response:
When you perform a squash merge, you destroy the history of the commits that went into that merge. Oftentimes this is the intent, since people use it to allow developers to write poor quality commit messages or create a messy history and then not have to deal with the results of that in the main branch.
However, you have nonetheless destroyed history, and as such, as far as Git is concerned, there is only one author and one committer, and in this case, that happens to be you. The fact that your co-worker contributed is not reflected in the history because you destroyed that information.
If you want information to be correctly reflected, either don't use squash merges or don't have multiple contributors to the same branch if you do. Note that this may necessitate either dealing with a messy history or encouraging or requiring developers to write nice commit messages with a sane history (the horror!).