8 ms·
Show HN: ugit – Learn Git Internals by Building Git in Python
- numbers 6y agoLooks great! I'm wondering if there are other tutorials like this but for Ruby?
- pokstad 6y agoThe defacto version was in Ruby: https://shop.jcoglan.com/building-git/ https://shop.jcoglan.com/building-git/
- dimator 6y agoPolished presentation! I like to learn from first principles, so this is perfect. There is also write you a git: https://wyag.thb.lt/ https://wyag.thb.lt/
- narwally 6y agoI definitely agree that having a good understanding of git's internals is a must for using it to its full potential. I'm not sure you have to go as far as implementing it yourself, but it is a sure fire way to get there. For me it didn't all click into place until I understood the data model behind git[1]. A git project is just one big DAG of objects, and each object at its core is either a blob, a tree, or a commit. When you understand that, you can start to view every git command for what they actually are, a sequence of operations on this data structure. [1] relevant xkcd: https://xkcd.com/1597/ https://xkcd.com/1597/
- SomaticPirate 6y agoReminds me of https://codecrafters.io/challenges https://codecrafters.io/challenges
- at_a_remove 6y agoMaybe this is what I need to like git.
- codesections 6y agoThis strikes me as a cool and polished version of shit, the Git implementation Drew DeVault did in pure POSIX shell. https://git.sr.ht/~sircmpwn/shit https://git.sr.ht/~sircmpwn/shit
- wrycoder 6y agoUpvote for amusement. And from the link: “How to Use: 1. Don’t” LOL. Thanks! Both interesting!
- Conlectus 6y agoLooks neat! This reminds me heavily of the excellent Building Git by James Coglan[1]. From a cursory glance though, it doesn't seem to support reading packfiles. This was the big thing that prevented me from using a fully custom Git implementation when I wrote my git churn calculator[2]. For larger repositories, it seems that almost all files are stored in packfiles, rather than the conceptually simpler "loose" format. For me, the most valuable resource was reading the Git / libgit2 source and reference documentation. [1] https://shop.jcoglan.com/building-git/ https://shop.jcoglan.com/building-git/ [2] https://github.com/samdoiron/butter https://github.com/samdoiron/butter
- nikital 6y agoThanks! Note that ugit isn't supposed to be a custom compatible Git implementation, but rather a simplified Git-like implementation for teaching Git concepts. So even if ugit supported packfiles, it still won't be able to read a real Git repo.
- microtherion 6y agoSeconding the recommendation for "Building Git", one of the most lucid and edifying books I've read in recent years.
- ravenide 6y agoIs this tutorial interface (navigation, diffs, files/downloads at each step) custom made? It's pretty nice for this kind of format.
- travmatt 6y agoI was wondering the same, this format feels extremely intuitive for the material it explores. Looking at the HTML and the CSS class names I'd assume it was handmade, but it seems like standardizing this format or even generating this webpage format from a repo would be a useful tool. The comment left at the end is ambiguous as to whether it refers to the tutorial or the website as a whole.
- nikital 6y agoIt was custom made for the tutorial. I didn't release it yet because I mostly focused on polishing the tutorial itself and not the code for the interface. Do you think people would be interested in the interface by itself?
- burroisolator 6y agoI would certainly take a look. It would be amusing if you released it using the interface itself.
- necovek 6y agoLiteral programming from Knuth's WEB adapted to modern web ;)
- ponytech 6y agoDefinitely! It is so well done at first I though I was on a MOOC site and navigated to the home to figure out if there were more tutorials :)
- rchoudhury 6y agoYes, 100%. The tutorial on git is super cool, but for me the thought of constructing my own tutorials using a framework that got you here is even cooler.
- srathi 6y agoAwesome. I did the same while learning both Golang and git, and implemented parts of git in Golang. [0] [0] https://github.com/ssrathi/gogit https://github.com/ssrathi/gogit
- parksy 6y agoThis is great, I appreciate the effort that has gone into it. I have used git now for about 10 years, always via cli so I am pretty fluent with it and understand intuitively what is going on behind the scenes, but have only rarely needed to venture into the .git folders. Working through the steps in this tutorial is helping to give a foundation to that intuition. I love the presentation format and would like to see more like this, and in other languages. Is the tutorial itself available on github or elsewhere?
- nikital 6y agoI'm happy to hear that! You can clone the tutorial content using the link in the "Download" section. The interface isn't available yet on Github.
- gumby 6y ago> The real Git code is too complicated to be useful for learning basic concepts with ease. ... It deals with a lot of edge cases that we don't care about for learning. Good choice, well explained. More than a toy problem space but stripped of factors that obscure the lesson. The author knows what they are doing.
- nikital 6y ago> stripped of factors that obscure the lesson Yes! I'm going to adopt that wording. Originally I tried to do a screencast about guided Git source code exploration but it didn't work because of that reason.
- howon92 6y agoI logged in just to upvote and comment how nice this is! Well done :)
- spapas82 6y agoFor anybody interested I've built a python lib to read the latest commit from a git repo: https://github.com/spapas/python-git-info/ https://github.com/spapas/python-git-info/ This is a pure python implementation that started simple (just read a couple of files from the .git folder) but after a little I understood that for non trivial repos you'll need to deal with pack for files. Because I had already published the package I actually completed the pack parsing work but I have to confess that it's way too complex and I wouldn't have started the project if I knew better... In any case the source is there if you want to take a look!
- sorokod 6y agoSuch a well thought out interface, congrats!
- necovek 6y agoI believe this is a wonderful way for someone to learn a piece of technology in depth. But I have to wonder if you actually had anyone (else!) successfully _use_ this to further their understanding of git? Generally, for me, it's either myself doing the exercise unguided, reading the documentation on internals, or reading the original source code. So I am certain it was a huge benefit for you, but it's more of a question on the approach being used with "students" and how successful would it be?
- nikital 6y agoI've seen people's Git skills improve after I taught them Git internals, but I taught them in a standard lecture format. I didn't try teaching Git internals using code before, but I hypothesized it would be a good idea, and here is the result :) I'm curious about its effectiveness as well.
- necovek 6y agoThen kudos on the effort for the experiment: not sure how I can best track the success of this initiative of yours, but best of luck regardless!
- mraza007 6y agoReally cool Implementation if you don’t mind can you share how did you build this