RedditPP Mascot

RedditPP

r/git • … • u/In_The_Comments

Question about commit history when merging from develop/master back into a feature branch

I've looked for a question similar to mine in the subreddit, but didn't find anything that was specific to my question.

My repo is a hybrid Git Flow, but the question applies to trunk-based and regular Git Flow also.

So, we've got a master branch and a staging branch, and feature branches that come off of master, get merged into staging for testing, then get merged to master when they pass QC. As part of that, we merge from master back into the feature branch to make sure the feature branch has the latest and greatest code.

When we merge from master, doesn't that bring along changed files and commit history that is irrelevant to the feature branch? For instance:

* On Monday, I branch off of master to a feature branch. * On Tuesday, another dev branches from master to a separate feature branch. He's working on something totally different than I am. * His work is quicker, so he gets his work tested in staging and merged to master on Wednesday. * On Thursday, I test on staging and everything is good, so I merge master into my feature branch. It merges with no merge conflicts. But now, the other dev's changes are part of my commit history, and \`git log --raw\` or \`git reflog\` list his files as well as mine.

(I can put together a commit graph of my question if that doesn't make sense.)

Assume that there's no merge conflicts, or any incompatibilities between his code and mine. My concern is that, since the other dev's commits and files are completely unrelated to mine, doesn't that make my commit history "dirty?" Or does it even matter?

— 0