Gittyup icon indicating copy to clipboard operation
Gittyup copied to clipboard

How can I tell Gittyup to only show commits between two commit ids?

Open PenelopeFudd opened this issue 3 years ago • 8 comments

I've got a git repository with release branches, feature branches and developer branches, and I'd like to pick any two commits on the tree and hide commits and branches that are not on a path between them.

  • In the simplest case, one of the commits is mainline: the result would be identical to "single branch view" (a linear graph).
  • More complex: the commits are from different branches (a forked graph).
  • Most complex: the branches have merged from mainline one or more times (a crazy quilt/bus schedule).

Once the graph is on the screen, I'd like to:

  • Click on a node and see the files in the tree at that point in time,
  • Show the git log and/or diff of those commits,
  • Cherry-pick commits from the graph into an arbitrary branch.

To describe it with an analogy, imagine I'm a plant breeder, and I want to grab good traits from many different plants and combine them all into one.

Can I do that with Gittyup?

Thanks!

PenelopeFudd avatar Jun 07 '22 16:06 PenelopeFudd

Hi @PenelopeFudd currently it is only possible to show only a single branch. But not between specific commits.

I understand your analogy, but I don't understand why you would like to do that? Do you have a real scenario?

Murmele avatar Jun 09 '22 08:06 Murmele

Sure: I've been working on a feature branch for weeks, and want to see all of the commits between my branch and the latest release branch. Once I can see them, I'd like to see what each commit will change, so I can decide to cherry-pick them into my branch. It would also be nice to color the commits by whether they pass some test, like the script that can be used with git-bisect.

The obstacle is that we have 20 developers, each working on a different branch, sometimes merging their branches to master, sometimes cherry-picking their commits into a release branch. The resulting git graph becomes exceedingly complex, and most of it is not useful for solving my immediate needs.

PenelopeFudd avatar Jun 10 '22 00:06 PenelopeFudd

Sounds like a quite big feature. Don't know if right now someone finds the time to implement all of this.

Murmele avatar Jun 10 '22 09:06 Murmele

Is there a way to graph git log ${ref1}..${ref2} ?

Or maybe git rev-list --ancestry-path ${ref1}..${ref2} https://stackoverflow.com/questions/18679870/list-commits-between-2-commit-hashes-in-git

PenelopeFudd avatar Jun 10 '22 20:06 PenelopeFudd

Currently there is no way to do it. Can you propose how to integrate it into the gui? Adding a third option beside the "show branches" drop down menu and if you select something like "show branches between ..." it shows another row where you can enter git commit hashes?

grafik

Murmele avatar Jun 14 '22 12:06 Murmele

Perhaps have a spot to enter a git command such as git log $args, git rev-list $args, or any other command that prints a list of commit ids, and then graph the commits returned (a subgraph).

To draw the subgraph, it could be that you'd start with the full repository graph like you have now, and then make all the nodes transparent (or mostly transparent) except for the selected nodes. The idea being that it'd be both easier to implement (the code to draw the tree is already written), and easier to understand (the nodes won't move around, just like how cities on maps don't move around).

That said, there is an argument to be made for rearranging nodes if it makes the graph simpler to understand.

And it might be better to just make the selected nodes and edges glow brightly while leaving the rest of the graph as-is.

At this point, figuring out the "best" solution is partly aesthetics and partly UX design. One problem is that there are so many definitions of "best". :-)

PenelopeFudd avatar Jun 14 '22 16:06 PenelopeFudd

Is that too complex?

PenelopeFudd avatar Jun 22 '22 21:06 PenelopeFudd

I think for 1.2.0 it is too much, but maybe we find time to implement it in 1.3.0

Murmele avatar Jun 24 '22 13:06 Murmele