rbong / vim-flog

A blazingly fast, stunningly beautiful, exceptionally powerful git branch viewer for Vim/Neovim.
750 stars 22 forks source link

Feature request - related branches #90

Closed datalogics-kam closed 3 weeks ago

datalogics-kam commented 2 years ago

I love Flog! I'm using it to make a lighter/faster Git experience as an alternative to using Magit in Emacs.

Magit has a really useful "related" graph view. If I use magit-log-related it shows me my current branch, the branch on the origin remote, and the branch it's tracking on upstream.

For instance, I could emulate it for my current work like this:

git glog update-packages origin/update-packages upstream/develop

It'd be really nice if there were such a feature in Flog.

The function doc looks like this:

magit-log-related is an autoloaded, interactive and byte-compiled
function defined in magit-log.el.

Signature
(magit-log-related REVS &optional ARGS FILES)

Documentation
Show log for the current branch, its upstream and its push target.

When the upstream is a local branch, then also show its own
upstream.  When HEAD is detached, then show log for that, the
previously checked out branch and its upstream and push-target.

And you can see the source for it here.

bew commented 1 year ago

Great idea! I really like using @{u} in my git log aliases to get useful info, for example @{u}.. to get commits yet to push :) Having related branches in the plugin would be a nice bonus :+1:

To help implementation: For upstream, we can use: some-branch@{upstream} (or short form some-branch@{u}) For push target, we can use: some-branch@{push}

I'm not sure how that should work (or not) on a detached head though :eyes:

rbong commented 1 year ago

Maybe something like an argument -related, and a binding to toggle this argument?

I like it, but it would be the first argument added to Flog that isn't a direct analogue for a git log argument.

There's a question right now whether we should make arguments closer to git log or farther. See https://github.com/rbong/vim-flog/issues/68

Thinking about it.

rbong commented 3 weeks ago

I added the -related flag.

It works slightly different to Magit. Magit will only include the upstream and push target for the related branches. Flog will include any branches with the same name.

I thought this would be useful for cases where you're dealing with multiple upstream or downstream remotes that have the same name, ex. user1/master, user2/master, user3/master, master. Please let me know if this is too broad or if you have other feedback.