We have a several major master pages on our web site and we have to share header for them (things like google tag manager, boostrap etc.) For that we use a placeholder web part where we specify "page to display", i. e. we've created a page called it "shared header", put there one web part "Head HTML Code", added the content we wanted share in all page headers. On each on the masters we have a placeholder web part that points to "shared header" page.