Repository navigation
cheat-sheet: proposal to update graphviz diagrams to git-sim visualizations - #2229
initialcommit-io wants to merge 2 commits into
Conversation
The five "Combine Diverged Branches" command sequences are updated from static graphviz diagrams to animated git-sim visualizations in the same theme and style. Light/dark mode behavior is preserved. Each Git command sequence is made up of a series of individual command steps, smoothly animating the transitions between them (switch, rebase, merge, squash merge, ff-merge, and cherry-pick). The pages under static/git-sim/cheat-sheet are generated with git-sim from dummy repositories shaped like the existing graphviz diagrams. They share one stylesheet and one script under static/git-sim/assets, and static/js/git-sim-embed.js loads each diagram into its container as it scrolls into view. Nothing is requested outside git-scm.com. Implementing additional git-sim visualizations going forward is just a matter of committing their html files, and adding their placeholders in the corresponding page. Signed-off-by: Jacob Stopak <jacob@initialcommit.io>
|
@jvns I guess this PR and discussion is relevant to your interests. Personally, I am mostly interested in keeping the printable cheat sheet in a useful and visually-pleasant state... but then, if I was more talented with documentation, Git's manual pages would be in a much better shape, much of them is my fault. So I'll see myself out now. |
|
This is very impressive! My main concerns are:
I'd love to hear more about your process for getting feedback from users on GitSim and your interactive visualization work! I've built a lot of interactive playgrounds personally but I find actually doing the playtesting with users to make sure they're getting the value from it is really tricky. Even if this doesn't have a place in the cheat sheet, I was talking to someone at Git Merge about the idea of building an interactive Git playground on the site (like https://go.dev/play/) where you can run arbitrary Git commands and it gives you a visualization of what each command did. I'm curious about whether Git Sim can do that. |
|
Thank you @dscho and @jvns for taking a look so quickly and for the great points! Considering this is a cheat-sheet medium, I definitely went overboard on the size of the diagrams in the PR 😅 , but admittedly didn't spend much time on perfecting this or PDF functionality as this was more to spark a conversation. But both should be fairly easily addressable. If you don't mind I would like to try another attempt at this by optimizing space, removing unneeded UI elements, and matching the git object size to current graphviz size. I'm also curious now whether I can get it even smaller than the graphviz versions, since the before and after state can be represented on the same diagram (due to the animations showing the state transition on the same graph). Since a PDF can only capture a single state, this would need to be taken into account to expand the before/after states in this case if both are desired. However the bigger concern for me is what you mentioned @jvns - that you didn't necessarily find the animations to be clearer than the static before/after diagrams, as this would make the compactness discussion moot. I do see your point as there is something intuitive to the brain about seeing a nice simple before/after state simultaneously. However, in my experience there are certain Git concepts that are abstract enough that seeing their "motion" can significantly boost understanding, especially to newer Git users. This especially applies to HEAD (and refs in general), which was one of the most confusing concepts to me when first learning Git as refs can be moved around in very unintuitive ways by various Git commands. At the time my brain just had no idea how to conceive of what a ref really was, which in hindsight is funny/frustrating due to how simple and (to be blunt) "dumb" they are 😄 once you know how Git works under the hood. In my opinion the motion is also helpful for commands where commits "move around" so to speak, such as rebases and cherry-picks, and also how file changes move around in the working dir/index/stash/etc. So it does make me wonder if there is a happy medium where animations could be used in a thoughtful way where they might be most effective, without just throwing them in needlessly... Let me chew on this a little bit and see what I can come up with... As a tangent, I'm also curious how you both feel about a "customizability" feature in the cheat sheet - by that I mean users being able to select a subset of commands they need/use the most and download/print those, since users (sometimes) are the ones who know their own situation best, which commands they use the most, which they are constantly looking up. Regarding a visual Git playground thingy - I have thoughts 😸. The most popular one is likely learn-git-branching, but my biggest qualm with it is that (as far as I know) doesn't operate within the context of the user's repo, so you are really can't match the exact context that Git user's are working in. That context gap is the main one git-sim is designed to fill, but not sure it really matters for what you're envisioning. Anyway, git-sim can sortof do this. It has a "live mode" which currently is triggered from the terminal within a local git repo by running PS: I was so sad to miss Git merge this year! I loved going the past few years but just couldn't justify going all the way to Portugal this time 😢. |
|
Yeah agreed that the biggest issue is whether the animations are clearer or not.
What's an example in the cheat sheet you think this applies to? |
Clean up the git-sim visualizations and their corresponding UI to significantly compact their size on the cheat sheet, reducing the vertical space they take up by 25% compared to the original graphviz versions. Also include ui enhancements to better match the original diagrams and best illustrate the git commands being described.






Hello! I noticed on the Git mailing list that the notes from the 2026 Git contributors summit were posted, and that there are currently efforts underway to improve/clarify Git's documentation and learning resources, especially in the leadup to the release of Git 3.0. I would love to help contribute to this.
Some context
I have made some small contributions to Git in the past and have attended multiple contributor summits (mainly as someone deeply interested in Git as opposed to a core contributor), but have mainly spent the past several years working on visual Git tools to help make learning and using Git more intuitive. My main project is called git-sim (https://github.com/initialcommit-com/git-sim), which is an open-source tool enabling users to visually simulate Git commands in their own repos.
I recently updated it to generate lightweight, web-native outputs instead of just image and video files, and now it can visualize a series of consecutive Git commands or even entire sequential workflows.
Why I submitted this PR
After noticing the ongoing efforts to enhance Git's learning resources, I stumbled upon the static graphviz diagrams on the git-scm cheat sheet, and it got me thinking that lightweight animations might help communicate Git concepts even more clearly and align with the team's goals of clarifying Git as much as possible, esp for newer users.
So I put together this PR as a WIP draft / proposal to test out this idea. I swapped out the five graphviz diagrams in the "Combine Diverged Branches" section with animated, interactive Git command sequences generated by git-sim in dummy repos shaped like the original diagrams. See GIFs and screenshots below (note that these GIFs / screenshots are just provided so you can see what it looks like - the actual Git animations are web-native SVGs and HTML are integrated via my pull request). I themed them using existing design language from the cheat sheet page and they are compatible with light/dark mode toggling. (I encourage you to spin it up locally and see how it looks on the cheat sheet page itself, as it's much smoother and more interactive than the GIFs below).
git rebase maingit merge bananagit merge --squash bananagit merge banana(fast-forward)git cherry-pick <commit>And here is are some screenshots of what it looks like embedded on the actual cheat sheet page:
What's in the PR
content/cheat-sheet/_index.html: Update graphviz diagrams to their corresponding git-sim counterparts.static/git-sim/cheat-sheet/*.html: The five web-native git-sim command visualizations. They share one stylesheet and one script understatic/git-sim/assets/.static/js/git-sim-embed.js: The only script loaded globally by the cheat sheet page - loads each simulation into its iframe when scrolled to.static/git-sim/assets/git-sim-session.js: Loaded in each simulation's iframe (not globally) to perform animations, handle interactions, and embedded controls.assets/sass/cheat-sheet.scss: Small styling updates.All assets are static and served from git-scm.com. FYI there is a discreet link to the git-sim GitHub page in the "?" help menu on each visualization.
To try it, run
hugo serveand open/cheat-sheet.html. git-sim is not needed to build the site.TO DO / Issues
I'd love to hear your thoughts on this and whether you think it would improve the cheat sheet, docs, or Git learning resources. Happy to discuss any changes to design, implementation, or scope 🙂