tig icon indicating copy to clipboard operation
tig copied to clipboard

collapse merges

Open yshavit opened this issue 7 years ago • 10 comments

A lot of times, I don't care at all about what's in a merge. For instance, I might see something like:

60 minutes ago Alice  o BUG-123 even more work on my bug
55 minuets ago Alice  o BUG-123 more work on my bug
50 minutes ago Alice  M─┐ Merge branch 'master' into bugs/BUG-123
    2 days ago Bob    │ o working on some other feature
    2 days ago Bob    │ o something else
    2 days ago Bob    │ o I really don't care about this   
45 minutes ago Alice  o │ BUG-123 starting work on fixing my bug
40 minutes ago Alice  o │ BUG-123 writing tests for my bug

Here, Alice merged master into her branch, but I'm not interested in that stuff; I just want to see Alice's work. It'd be nice if I could collapse that merge, and everything that came with it:

60 minutes ago Alice  o BUG-123 even more work on my bug
55 minuets ago Alice  o BUG-123 more work on my bug
50 minutes ago Alice  ︙ Merge branch 'master' into bugs/BUG-123
45 minutes ago Alice  o BUG-123 starting work on fixing my bug
40 minutes ago Alice  o BUG-123 writing tests for my bug

(I haven't found any git clients, GUI or CLI, that do this, so I'm guessing there's a reason why it's hard... but just in case not, I thought I'd suggest it here.)

yshavit avatar Jan 04 '18 19:01 yshavit

Does tig --first-parent or git log --first-parent provide the behaviour that you want? Edit: fixed example git command

robhalbert avatar May 23 '18 09:05 robhalbert

Almost, but not quite. :-\ What I really want is a way of essentially doing that interactively. For instance, I might want a view initially that looks like --first-parent, but then be able to expand a merge to see all of the commits that went into it (as if I hadn't done --first-parent, but just for that one merge).

yshavit avatar May 23 '18 15:05 yshavit

Unfortunately I'm not aware of any git clients that implement this at present, but I agree that this would be a useful feature.

robhalbert avatar May 23 '18 15:05 robhalbert

@robhalbert, magit by @tarsius can do this

This is an expanded view:

image

and that's the collapsed view (magit calls it "-simplify-by-decoration")

image

I don't like how magit hides the branch structure, anyway, but probably it's me I don't know how to properly use it.

edit: just discovered this option is available from git itself!

git log --oneline --all --graph --decorate --simplify-by-decoration

arialdomartini avatar May 21 '19 07:05 arialdomartini

I implemented a MVP application, as tig(1) alternative, which implements exactly this. It's not yet ready to be made publicly available, I still hope you guys implement this feature and I can bury my app. :)

The Screenshot show the git(1) repository. The cursive commits prepended by a are the forkpoints.

Screenshot from 2019-05-21 10-02-37

kalkin avatar May 21 '19 08:05 kalkin

That's lovely, @kalkin! Looking forward for a Pull Request from you!

arialdomartini avatar May 21 '19 09:05 arialdomartini

Just to keep the expectations low. I don't plan to make a PR to tig implementing this feature. Tig code base is to complex to understanding how to do it right. The only way I could imagine if @jonas or some other main developer of tig would do a Hackaton with me. I actually figured out how exactly to get the results I want from git with all the edgecases, but it's hard to implement it in an foreign code base.

kalkin avatar Oct 14 '19 09:10 kalkin

For those who want to play with kalkin's tool: :heart:

git clone https://github.com/kalkin/scm  
make          # drink a cup of java while maven works...
make install  # no root, installs under ~/.local
scm

cben avatar Mar 26 '20 18:03 cben

:rofl: Congratulation this is the first implementation of this concept. I don't use it any more. My daily driver is something different, which is I think a third(?) implementation? Just a week ago I marked the version 1.0.0, because it works very well for me currently. I just made the repository public, have fun & PRs are welcome ☺ https://github.com/kalkin/pygit-viewer

kalkin avatar Mar 26 '20 20:03 kalkin