TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: ugit – Learn Git Internals by Building Git in Python

309 点作者 nikital超过 4 年前

16 条评论

Conlectus超过 4 年前
Looks neat! This reminds me heavily of the excellent Building Git by James Coglan[1].<p>From a cursory glance though, it doesn&#x27;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 &quot;loose&quot; format.<p>For me, the most valuable resource was reading the Git &#x2F; libgit2 source and reference documentation.<p>[1] <a href="https:&#x2F;&#x2F;shop.jcoglan.com&#x2F;building-git&#x2F;" rel="nofollow">https:&#x2F;&#x2F;shop.jcoglan.com&#x2F;building-git&#x2F;</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;samdoiron&#x2F;butter" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;samdoiron&#x2F;butter</a>
评论 #24520597 未加载
评论 #24520790 未加载
codesections超过 4 年前
This strikes me as a cool and polished version of shit, the Git implementation Drew DeVault did in pure POSIX shell. <a href="https:&#x2F;&#x2F;git.sr.ht&#x2F;~sircmpwn&#x2F;shit" rel="nofollow">https:&#x2F;&#x2F;git.sr.ht&#x2F;~sircmpwn&#x2F;shit</a>
评论 #24522712 未加载
dimator超过 4 年前
Polished presentation! I like to learn from first principles, so this is perfect.<p>There is also write you a git: <a href="https:&#x2F;&#x2F;wyag.thb.lt&#x2F;" rel="nofollow">https:&#x2F;&#x2F;wyag.thb.lt&#x2F;</a>
ravenide超过 4 年前
Is this tutorial interface (navigation, diffs, files&#x2F;downloads at each step) custom made? It&#x27;s pretty nice for this kind of format.
评论 #24525537 未加载
评论 #24522551 未加载
gumby超过 4 年前
&gt; 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&#x27;t care about for learning.<p>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.
评论 #24525564 未加载
spapas82超过 4 年前
For anybody interested I&#x27;ve built a python lib to read the latest commit from a git repo: <a href="https:&#x2F;&#x2F;github.com&#x2F;spapas&#x2F;python-git-info&#x2F;" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;spapas&#x2F;python-git-info&#x2F;</a><p>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&#x27;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&#x27;s way too complex and I wouldn&#x27;t have started the project if I knew better...<p>In any case the source is there if you want to take a look!
necovek超过 4 年前
I believe this is a wonderful way for someone to learn a piece of technology in depth.<p>But I have to wonder if you actually had anyone (else!) successfully _use_ this to further their understanding of git?<p>Generally, for me, it&#x27;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&#x27;s more of a question on the approach being used with &quot;students&quot; and how successful would it be?
评论 #24526906 未加载
parksy超过 4 年前
This is great, I appreciate the effort that has gone into it.<p>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.<p>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.<p>Is the tutorial itself available on github or elsewhere?
评论 #24525520 未加载
SomaticPirate超过 4 年前
Reminds me of <a href="https:&#x2F;&#x2F;codecrafters.io&#x2F;challenges" rel="nofollow">https:&#x2F;&#x2F;codecrafters.io&#x2F;challenges</a>
numbers超过 4 年前
Looks great! I&#x27;m wondering if there are other tutorials like this but for Ruby?
评论 #24519841 未加载
srathi超过 4 年前
Awesome. I did the same while learning both Golang and git, and implemented parts of git in Golang. [0]<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;ssrathi&#x2F;gogit" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ssrathi&#x2F;gogit</a>
mraza007超过 4 年前
Really cool Implementation if you don’t mind can you share how did you build this
narwally超过 4 年前
I definitely agree that having a good understanding of git&#x27;s internals is a must for using it to its full potential. I&#x27;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&#x27;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.<p>[1] relevant xkcd: <a href="https:&#x2F;&#x2F;xkcd.com&#x2F;1597&#x2F;" rel="nofollow">https:&#x2F;&#x2F;xkcd.com&#x2F;1597&#x2F;</a>
at_a_remove超过 4 年前
Maybe <i>this</i> is what I need to like git.
howon92超过 4 年前
I logged in just to upvote and comment how nice this is! Well done :)
sorokod超过 4 年前
Such a well thought out interface, congrats!