Skip to content

Teach git diff --color-words to be helpful when there are merge conflicts #386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dscho opened this issue Oct 10, 2019 · 0 comments
Open

Comments

@dscho
Copy link
Member

dscho commented Oct 10, 2019

Note: this project is technically challenging, as it touches two complex parts of Git's code: the diff machinery and the staging area/worktree with conflicts.

The --color-words option allows visualizing differences between two file versions on a word-level (rather than a line-level).

Currently, the --color-words option is totally ignored when visualizing merge conflicts in a worktree. All conflicted lines, including the conflict markers, are marked in green, as if the --color-words option had not been present at all.

A much more useful thing to do would be to build temporary buffers from the two sides of each conflict and then present the color diff of those buffers (the first side with an implied --reverse).

In case that it is a diff3 style conflict, there are three sides in each merge conflict (the "middle" one being the base), so the first side could show a --color-words diff between base and the first side, and the last side could equally show a --color-words diff between base and the last side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant