News for hackers. Stuff that matters.
Re:Visualizing Git Concepts with D3 by kevsim on Sunday November 01, 2020 @02:52AM (#24957877)
This is cool!

For anyone wishing to learn why git is the way it is, I always recommend reading Git From the Bottom Up [0]. I don't consider myself a git guru, but I found this to be a really great read to understand the underlying concepts.

0: https://jwiegley.github.io/git-from-the-bottom-up/

Re:Visualizing Git Concepts with D3 by gilad on Sunday November 01, 2020 @12:39PM (#24961070)
Pls consider submitting the link above as a standalone HN item, it’s great
Re:Visualizing Git Concepts with D3 by crispyambulance on Sunday November 01, 2020 @08:52AM (#24959500)
This is nice. I wish it existed years ago.

Since the git commandline isn't ever going to be anything but insane and confusing, it really helps to be able to visualize what's going on. I think a sizeable portion of developers reason about their work graphically, even though their work appears textual. Being able to do this successfully demands an iron-clad understanding the tools, and/or tools which map neatly and consistently to concepts.

The concepts behind git operations aren't hard. It's the incoherent commands that make people miserable, confused and mistake-prone. Git operations become crystal clear when represented graphically.

Re:Visualizing Git Concepts with D3 by fwip on Sunday November 01, 2020 @12:45PM (#24961099)
The last commit was 3 years ago, so, it did. :)

It would be awesome if somebody wanted to update this with the newer, more ergonomic git commands. (Like `git switch`).

Re:Visualizing Git Concepts with D3 by ghevshoo on Sunday November 01, 2020 @02:32AM (#24957815)
Don’t miss the awesome “zen mode”.

https://onlywei.github.io/explain-git-with-d3/#zen

This the the best tool I’ve found to demonstrate to people, how commits that no longer appear in your history due to rebase or amend etc, are still there in your repository.

Re:Visualizing Git Concepts with D3 by Bishonen88 on Sunday November 01, 2020 @03:18AM (#24957983)
Zen mode works ~1 out of 3 tries. The other 2, it doesn't render anything other than the top part. Seems a hard refresh (command+shift+r) does the trick on chrome
Re:Visualizing Git Concepts with D3 by Amorymeltzer on Sunday November 01, 2020 @07:07AM (#24958908)
I use rebase a lot and consider myself quite comfortable with it, but even for me I find this hugely helpful in visualizing what actually happens.
Re:Visualizing Git Concepts with D3 by stinos on Sunday November 01, 2020 @03:11AM (#24957947)
Sounds vaguely familiar, and indeed I had bokmarked a site which did this exactly (just more elaborate, IIRC was built as a complete tutorial). Site (https://news.ycombinator.com/item?id=7450528) is dead now unfortunately, would have been good to get inspiration from. https://learngitbranching.js.org is still alive though.
Re:Visualizing Git Concepts with D3 by cinntaile on Sunday November 01, 2020 @05:43AM (#24958579)
It's the same guy so that probably explains why it looks familiar. According to the commits in this repo the website you refer to was the same content, only slightly delayed compared to the github page. https://github.com/onlywei/explain-git-with-d3/commit/93fe62...
Re:Visualizing Git Concepts with D3 by DataCrayon on Sunday November 01, 2020 @06:32AM (#24958773)
I like it!

For those interested, I'm working on a D3 book on how to create unique visualisations with D3 https://datacrayon.com/shop/product/visualisation-with-d3/

Re:Visualizing Git Concepts with D3 by adkadskhj on Sunday November 01, 2020 @10:08AM (#24959934)
Somewhat of an aside, has anyone seen a way to visualize this type of graph without javascript? I'm looking to visualize hundreds of graph relationships and am hoping to not use JS. Admittedly though this example looks fairly performant, all the other ones i've seen are super laggy.

Ultimately i think i just want to find a decent way to use CSS to replicate this style - but i've not seen any CSS gurus manage to produce that.

Though, WebGL might be the best way regardless.

Re:Visualizing Git Concepts with D3 by jcranmer on Sunday November 01, 2020 @11:20AM (#24960448)
The graphviz tools, also known by dot (the most well-known tool), are a good way of visualizing smallish graphs, up to a few thousand nodes. Although do note that graph layout tends to be heavily dependent on what kind of graph you actually want to visualize; an algorithm that works well for one type of graph may look atrocious for other kinds of graphs.

The algorithm used by dot (Sugiyama layout) works well for trees or any other graph where the structure is well-approximated by a tree. Control-flow graphs are the prototypical example of the latter (being the use case dot was explicitly designed for), but the VCS commit graph is also going to fit in well in this model. If you have a graph which has many more cycles in it, or has a crisscrossing connectivity pattern like a hypercube, the resulting layout from dot is going to be a giant ball of twine.

Re:Visualizing Git Concepts with D3 by adkadskhj on Sunday November 01, 2020 @12:31PM (#24960998)
Interesting. In case you're curious: The graph is git-like structure, but a tree. Trees of close-to-b-trees specifically, where each (key) value can point to another tree. There's really no limit to how wide these are, or how many connected trees there are - so i'll have to put artificial visualization limits on this. Still, i'd like to be able to view large trees of trees, with thousands of nodes in a performant manner.

Most demos i've seen on JS libraries have been laggy with just a handful of nodes - but they're also trying to do fancy animations/etc by default. Hopefully i can hook up D3 with some minimal effort - or perhaps render it in a game library. /shrug

Re:Visualizing Git Concepts with D3 by fwip on Sunday November 01, 2020 @12:53PM (#24961161)
d3 is primarily a javascript tool to turn data into structure - kind of like React. You may want to render to SVG (like the link this submission is about) or canvas, and then just update a few attributes/transforms on user-input, like panning, scrolling, etc. That way, the browser does the hard work of rendering the nodes, and the updates are pretty light on the javascript-side.
Re:Visualizing Git Concepts with D3 by zests on Sunday November 01, 2020 @10:30AM (#24960084)
How insane are you?

Old me would have been able to do this in LaTeX.

Re:Visualizing Git Concepts with D3 by daanluttik on Sunday November 01, 2020 @10:35AM (#24960129)
You can do a lot with Graphviz it had bindings for many libraries.
Re:Visualizing Git Concepts with D3 by Noumenon72 on Sunday November 01, 2020 @01:05PM (#24961245)
This is why I refuse to use Git from the command line -- it all makes perfect sense visually. Why mess around with hashes when you could just be clicking on the commit you want in a GUI and telling it to move?
Re:Visualizing Git Concepts with D3 by stinos on Sunday November 01, 2020 @01:27PM (#24961382)
Because it's really hard to automate that, just to give one example?
Re:Visualizing Git Concepts with D3 by _genesis on Monday November 02, 2020 @08:59AM (#24968159)
I have the same idea for a practice project :) Also, because I love git and want to help people get better grasp of it.
Re:Visualizing Git Concepts with D3 by geongeorgek on Monday November 02, 2020 @07:42AM (#24967506)
Thank you this is what I was missing last month when I took a git workshop. Amazing work!
Re:Visualizing Git Concepts with D3 by maccard on Sunday November 01, 2020 @05:28AM (#24958521)
Afraid this just doesn't work for me on FF 82.0.2 on windows 10
Re:Visualizing Git Concepts with D3 by arthurmorgan on Sunday November 01, 2020 @06:12AM (#24958699)
It worked for me after reloading and turning off uBlock. Maybe you also need to reload a few times.
Re:Visualizing Git Concepts with D3 by solarkraft on Sunday November 01, 2020 @08:00AM (#24959168)
From my little testing it seems like uBlock doesn't make a difference (shows 0 blocked elements) and it's really the reloading that does the trick. It seems to switch between working and not working every few seconds.

Edit: I just tested a bit more and last time the non-working period was a good minute. I'll stop DoSing now.

Re:Visualizing Git Concepts with D3 by stjohnswarts on Sunday November 01, 2020 @05:32PM (#24963121)
Probably one of your extensions blocking it. Turn off stuff like ublock and privacy badger and reload. I tried on Mac Firefox and it does indeed fail in even safe mode.
Re:Visualizing Git Concepts with D3 by fortydegrees on Sunday November 01, 2020 @06:10AM (#24958689)
Neither for FF 81.0.1 on macOS Catalina
Re:Visualizing Git Concepts with D3 by dionian on Sunday November 01, 2020 @11:46AM (#24960658)
this is amazing, i learned a lot about git from a similar, non-interactive talk,. this is much better

one suggestion, let user hit up arrow to auto-type suggested command

Re:Visualizing Git Concepts with D3 by jvilalta on Sunday November 01, 2020 @09:44AM (#24959771)
Nice, thanks for putting this together.