r/programming • • 1d ago

Design mistakes I made in my open-source project git-sim in 2022

https://initialcommit.com/blog/git-sim-mistakes-and-fixes
23 Upvotes

11 comments sorted by

0

u/chucker23n 1d ago

Looks neat. I was rather confused by the rebase animation, because

  • the x axis goes backwards in time
  • the arrows point in an unintuitive direction as well (probably meant to say “builds on top of”)

Also:

The result is that the vast majority of users can install git-sim with the single command pip install git-sim

I would venture to guess most developers do not have Python and do not know what pip is. This is an improvement, but still less than ideal.

10

u/irqlnotdispatchlevel 1d ago

Most developers don't have python?

5

u/chucker23n 18h ago

I would imagine so. Windows doesn't ship it, and macOS only ships it any more if you install Xcode. Most Linux distros probably still ship it. But there's tons of developers out there who don't frequently come into contact with Python. Or even, say, C++.

Like, if you're doing corporate client work and building yet another ERP, odds are you're not gonna have a Python toolchain.

1

u/initcommit 1d ago

Hey thanks so much for checking it out and the feedback! Is it the solid arrows pointing backwards from commit to commit that is confusing or the dotted rebase arrows showing how the rebased commits move? Re: the commit arrows, you probably know this about Git already but Git graphs generally use those arrows to show parent/child relationships between commits. I.e. each commit points back to its parent (or parents in the case of a merge commit). Depending on order or operations, this doesn’t always mean “back in time”.

And you are totally right about the pip install not being enough, building proper release binaries and an automated pipeline for that is one of the next things I’ll work on.

Funny anecdote - before I originally released git-sim in 2023, I spoke with one of the maintainers of the official Git project, who recommended I flip the graphs the other way. I took his advice and about 99% of users were like “cool tool, but why on earth is everything going the opposite way its supposed to?!”. So i built in a ‘--reverse’ flag that reverses the direction of the whole graph, basically flips it over the Y axis. Not sure if this would make things clearer for you, seems like Git is kooky enough that different people’s brains form their own internal models of how to understand Git.

3

u/D_Denis 21h ago

Your git graph is not intuitive because it goes in the opposite directions of e.g. official documentation: https://git-scm.com/cheat-sheet#combine-diverged-branches

1

u/JayDepp 1d ago

I would assume it is much more common to expect the graph to grow toward the right.

0

u/initcommit 1d ago

Ha. Interesting! Do you think that’s because you’ve seen examples of resources that so it that way? Or just because that’s what feels more natural? I genuinely don’t think there is a foolproof solution to this since everyone seems to have a differing opinion on what feels intuitive to them.

1

u/JayDepp 1d ago

I'd guess left-to-right language and left-to-right time x axis are factors. Hard to say what I would've expected before seeing examples.

1

u/initcommit 1d ago

Yeah good point I’m sure that a person’s natural reading direction comes into play and can contribute to Git diagrams seeming non-intuitive, especially for folks less familiar with Git (don’t mean that as a dig 😅), probably due to the fact that when reading the words/stories kindof progress into the future in the left-to-right direction, so they expect a Git diagrams to follow suit.

But with Git and version control, most tasks that require thinking about the state of the repo involve starting at the point farthest into the future (i.e. the branch tip or current HEAD), and involve comparisons with or operations against versions (commits) further back in the history.

So a Git graph generally makes the most sense to be set up in a way aligns with Git’s model and how it’s commands work, and the ways devs typically think about performing Git tasks, despite being less intuitive for newer Git users. That’s what I suspect anyway…

1

u/OdinGuru 1d ago

I have seen many examples of horizontal git graph visualizations and every other one goes left to right same as almost all timelines. Just search for git graph images and you will see many examples. A very common one that many may be familiar with would be git hub. Also usually if arrow are shown they go from parent to child, but it’s also common to not have arrows too.

2

u/double-you 19h ago

everyone seems to have a differing opinion on what feels intuitive to them.

If 2 people out of 100 have a differing opinion, does that mean everyone has a differing opinion? Most people expect branches to go from left to right, from older to newer. And while indeed new commits point to old commits, which can seem backward to some people, you can avoid the whole issue by nothing having arrows at all. A line that connects all the commits works just fine.