You’ll also want to familiarize with “git apply -3 <file name>”, for when a diff can’t be applied cleanly. It will try “harder” to merge (three way method) and if it still fails it invokes the conflict merge “UX”:
<<<<<<<<<
=========
>>>>>>>>>
<<<<<<<<<
=========
>>>>>>>>>
https://github.com/neilbrown/wiggle
although on debian based systems I think you can just "apt install wiggle"
I know about wiggle, but I have not used it, to be honest.