I have tried this and it does not work (I have checked on Windows PC as well as on Linux server). Every time it overrides master branch’s file. I had created .gitattributes file (config.php merge=ours) in my repository’s root directory (where .git directory resides) and I have also executed “git config — global merge.ours.driver true” command on command prompt. But nothing worked.
Find my flow:
- config.php (text is “master config file”)
- index.html (text is “master index file”)
Both files were committed
- config.php (text is “stage config file”)
- index.html (text is “stage index file”)
git checkout master
git merge stage
and boomed. It overridden master branch’s config.php with stage branch’s config.php. So now master branch’s config.php says “stage config file”.