Show HN: Pygit – Just enough git to push itself to GitHub
benhoyt.com
benhoyt.com
Some time ago I did a similar exercise in Haskell: https://github.com/EarlGray/omit (it also took about 500 lines of unnecessarily dense Haskell), implementing barebone functionality of `git log`, `git add`, `git commit`, `git status`, `git diff` (using an existing Haskell diff library). It was eye-opening how simple the concepts of git are.
On the other hand, the most interesting parts of git are still left out: branches, merges, conflict resolution, remote sync. I'm wondering how many more lines are needed for this.
Exactly! Sometimes I'm bewildered how complex git porcelain (CLI interface) is compared to the basic building blocks.
Usually when I want to do something complex in git I think of how I want the structure to look like and then figure out which command does that ("was it git reset --soft or git stash --keep-index that did X?"). Now when I'm thinking about it I usually imagine states (like DOM trees). I see current state and the state I want to have the repo in (commits, working directly, index). What I'm missing here is a React-like reconciler that will transform one into other.
I love projects like this, because I think most of us would benefit from re-implementing our dev tools (at least partially) to develop a better understanding of how they work.
When I took a molecular cell biology class in college, the first series of labs involved disassembling and reassembling the bench microscopes that we would be using for the rest of the course (they were close to maxing out on optical resolution, the faculty couldn't afford to replace a broken one)
As an engineer I enjoy making my own tools, sometimes a little too much
More in that vein, for Python bytecode compiling and running: https://github.com/darius/tailbiter -- I can't quite resist mentioning it since I gave it a similar tag line, "just enough Python to Python in Python".
Gitlet is an implemention of Git in JavaScript.
I hope this isn't taken as a frivolous or mean-spirited comment, but the code samples on the blog would be much more readable with some kind of syntax highlighting.
My local Python group had a talk on something like this last year: https://github.com/glenjarvis/explore_git_internals