Closed gennaro-tedesco closed 1 month ago
Please see the documentation at :h :DiffviewFileHistory
.
You're looking for two different options here it seems, and they're both supported. First, file history for a specific rev range:
--range={git-rev}
Show only commits in the specified revision range.
Secondly, you wish to compare against a fixed base (in this case the local version of the file):
--base={git-rev}
Specify a base git rev from which the right side of the diff
will be created. Use the special value `LOCAL` to use the
local version of the file.
Example:
:DiffviewFileHistory % --range=7d1bc66 --base=LOCAL
How can I show the difference between the current state of the buffer and a specific commit - for the single buffer only (namely without toggling DiffviewOpen for the entire worktree)?
I wouldn't use file history for this, I would instead do:
:DiffviewOpen 7d1bc66 -- %
This is also listed as one of the examples under :h :DiffviewOpen
.
I wouldn't use file history for this, I would instead do:
DiffviewOpen 7d1bc66 -- %
oh, yes, indeed, this does exactly the job. Sorry, I must have missed that you can pass %
to DiffviewOpen
too (obviously I wouldn't have missed it if I had read the documentation more thoroughly :p, apologies).
I presume that this request is somehow included in the docs or in previous issues, however I have been unable to find an answer (even after some trial and error).
Is it possible to diff the current open buffer against a specific revision? I would expect it to work with something along the lines of
however the above opens the entire commit history of the relevant file. Whilst one could indeed open the history first and then search for the corresponding commit in there, doing so will show the commit patch in the diff view, namely the difference between the relevant commit and its previous one rather than the difference between the relevant commit and the current state of the buffer (say represented by HEAD). Likewise explicitly indicating
shows again the entire commit history once more.
How can I show the difference between the current state of the buffer and a specific commit - for the single buffer only (namely without toggling
DiffviewOpen
for the entire worktree)?