As Tim says you can't use XmlSlurper on your file. You can however manipulate the text before parsing.
If you convert the markers to custom xml nodes e.g.
xml = xml.replace("<<<<<<< HEAD", "<patch><part branch='HEAD'>")
xml = xml.replace("=======", "</part><part branch='myBranch'>")
xml = xml.replace(">>>>>>> myBranch", "</part></patch>")
you can then use XmlSlurper to read the text.
For each "patch" you can then decide which "part" you want to keep. Removing the unnecessary node and migrating the other node's children into the parent should get you close to what you want.