sindrets / diffview.nvim

Single tabpage interface for easily cycling through diffs for all modified files for any git rev.
Other
3.74k stars 105 forks source link

USAGE page seems to have a typing error. #355

Closed greyHairChooseLife closed 1 year ago

greyHairChooseLife commented 1 year ago

Here is link for the USAGE page.

There you can see right away like below. It has triple dots between git-revs.

:DiffviewFileHistory --range=origin/main...HEAD --right-only --no-merges

I cared nothing but only --range. So I set my default like :DiffviewFileHistory --range=origin/main...HEAD. And it returns me like...

from : arbitrary commit (but fixed at least) to : HEAD

And then I found there are only 2 dots for the option --range in README and :help page. That made me happy finally.

Since I couldn't find anywhere about triple dots for the option, I leave here issue for a typing error.

Thanks for the lovely plugin. God bless you.

sindrets commented 1 year ago

It's not a typo. Two-dot and three-dot rev ranges do not describe the same set of commits.

"Dotted Range Notations" from man git-rev-parse ``` Dotted Range Notations The .. (two-dot) Range Notation The ^r1 r2 set operation appears so often that there is a shorthand for it. When you have two commits r1 and r2 (named according to the syntax explained in SPECIFYING REVISIONS above), you can ask for commits that are reachable from r2 excluding those that are reachable from r1 by ^r1 r2 and it can be written as r1..r2. The ... (three-dot) Symmetric Difference Notation A similar notation r1...r2 is called symmetric difference of r1 and r2 and is defined as r1 r2 --not $(git merge-base --all r1 r2). It is the set of commits that are reachable from either one of r1 (left side) or r2 (right side) but not from both. ```

Take for instance this example commit graph:

image

Here we have two branches, main and feature, that have diverged. If we perform a symdiff on these two branches we get this set of commits:

image

Using --cherry-pick options we can specify which side of the symdiff we care about:

image

image

greyHairChooseLife commented 1 year ago

oh, I see.

As a beginner, I used to git diff for staged or unstaged files. Or to compare two of whole branches before I merge just-fetched upstream/*.

Yet no experienced the conflict between two branches but only between some commits when I rebase my own code.

But now your answer made sense to me very well. Thank you for your kindness, despite my dumb issue.