Add shortcuts to compare incoming/current with common ancestor #236491
+105
−14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Git has a diff style
diff3
orzdiff3
that shows the common ancestor of two conflicting commits in the conflict. For example:This is enormously useful when resolving conflicts. However sometimes git is dumb and you end up with conflicts that are difficult to follow.
For example suppose you have some
really long old code
, and you write somenew code
to replace it. You rebase your change, and find that someone has made a tiny tiny change somewhere in the really long old code. It might be relevant - it could be some change that you also need to apply to your new code. But the conflict just looks like this:Not too bad with 4 lines but sometimes it's hundreds, and then you end up visually diffing it, like a cave man.
There is an existing
Compare Changes
option, but it only comparesCurrent
withIncoming
. This commit adds two more options to compare the common ancestor withCurrent
orIncoming
instead, thus solving the problem once and for all.This was mostly straightforward. The two tricky bits are:
diff3
and still run the new compare commands from the command palette? In that case it falls back to not showing any changes.