So in order to run many parallel projects, we are exporting our metadata to XML within version control. As a result we often have to merge changes from multiple projects that affect the same file (a .object or .profile file for instance), and when resolving conflicts, we will occasionally duplicate an item or lose a required element within a block.
This might not be considered as an answer but somehow solves the problem you are facing.
Merge conflicts are painful. Different Tools/IDE's retrieve metadata in a different order. So yes when multiple devs merge there will be stupid conflicts that will take an eternity to resolve.
We resolved this using a different approach. We parse the metadata xml and store it in a mysql table. And then recreate a proper XML using the table rows. This kinda makes sure that you get unique values and no matter what tool ide you, your final XML will always be valid and proper.