One really common issue I encounter is that Git is purely text-based, and doesn't know anything about the language of the file it's tracking. Most of my time spent resolving merge conflicts is fixing incorrect assumptions made by Git, like it thinking that a change to a function's signature was also tied to the variables above, or that adding a function is somehow replacing a completely different one because a single word is the same.

Is there any way to substitute Git's diff-checker for one that actually understands the semantics of the language it's looking at?

3 Replies 3

--diff-algorithm.

Can be configured persistently

git config --global diff.algorithm <algorithm-name>

This is not an advice question. You should have selected the Troubleshooting and Debugging option, not Advice.

For merges:

You can define a mergetool. To invoke an external program when viewing/editing merge conflicts: see git help mergetool and the merge.<tool>.* settings in git help config.

Or even, if you have a reliable tool to resolve conflicts in easy cases, define a merge driver: see the "Defining a custom merge driver" section in git help gitattributes.

Your Reply

By clicking “Post Your Reply”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.