Maybe this is a stupid question. But. When I started using Git I was told that when working on a feature branch, before merging to master I had to merge everything from master to my branch. Now, that I can understand from a testing point of view. To be able to know that everything is working correctly with my code before merging it to master I should first test in my branch, hence I have to merge from master to my branch. In my current project we have another workflow. I have a feature branch, and then master acts as a staging branch, and then we have another production branch. Nice workflow btw.
But this have forced me start thinking on how branching and merging actually works in git. If developer D1 creates a branch A, and developer D2 later creates a branch B. Developer D1 does some work and merge branch A to master. Now D2 merges his branch B to master. Will only the actually changed files by D2 be merged to master, or will git try to merge every file that existed when D2 created his branch even those not changed? Should D2 before attempting his merge, have merged from master to branch B, or doesn't it matter?
My guess is that git only merge changed files, but I am not 100% sure :)