Closed fresh2dev closed 1 year ago
vim-fugitive starts a rebase at the commit under the cursor ... vim-flog starts a rebase after the commit under the cursor
There is a very good reason for this.
First of all, it's more accurate to say "Fugitive starts a rebase at the commit BEFORE the commit under the cursor". Flog is the one that targets the commit under the cursor. The fact that the commit itself is used as the target of the rebase and not a commit that is applied during the rebase is the nature of rebasing.
So Flog uses the default behavior of git. But that's not why we do it. If we could, we would use the same behavior as Fugitive for consistency. To understand why we do it this way, consider the following example.
In Fugitive, say you have a list of commits:
A
B
C
D
Say there is also a commit E
that is the parent of D
which is not shown.
There is no reason to rebase on top of A
because it's the current head, so we can just target its parent. However, if we DIDN'T target E
for the rebase, there would be no way to include D
as a commit in the rebase, because its parent will never be shown.
Consider the same commits in Flog:
* A
* B
* C
* D
* E
Now, there might actually be a reason to use A
as a target, since we might be using -all
or another flag, but if we targeted its parent, targeting A
itself would be impossible unless if it had another child. In addition, targeting E
is now possible.
This difference is because Fugitive and Flog show different things - Fugitive shows just unpushed changes, whereas Flog shows all commits. There is no way to reconcile the way targeting works, otherwise rebasing becomes impossible in some cases.
cc
...ca
These are very good ideas for mappings, the only reason they don't exist is because we didn't use to include any mappings that didn't target commits.
.
Also a good idea, thanks.
I'll hopefully get to implementing these today or tomorrow.
I've now documented the difference in rebase mappings in the help file.
I've added cc
, ca
, and ce
mappings. I haven't added cvc
etc. mappings yet.
I also added .
. I haven't yet added counts or visual selection for this command but I might soon.
Let me know if there are any problems.
Awesome; thanks for the prompt response, the through explanation, and all the great work! Really looking forward to the small-but-significant addition of .
:star_struck:
I am looking to replace my use of vim-fugitive's
:G log --graph --oneline
with vim-flog's:Flogsplit
given the many enhancements it offers.I often rely on vim-fugitive's mappings, namely ,
cc
,ca
,cs
,cf
,ri
,rf
.There are two gotchas in vim-flog related to it's keymapping parity with vim-fugitive.
ri
/rf
vim-fugitive starts a rebase at the commit under the cursor (g.g.,
git rebase --interactive a1b2c3~
).vim-flog starts a rebase after the commit under the cursor (e.g.,
git rebase --interactive a1b2c3
).Missing commit-mappings:
cc
,ca
Missing period mapping:
.
This is what finally motivated me to create this issue.
I often rely on pressing
.
on a commit for vim-fugitive to populate the command-line with: <commit>
. vim-flog doesn't do this.