Hacker News new | ask | show | jobs
by Jeremysr 2840 days ago
For project-based tutorials/books, which are centred around building a program step-by-step by following a series of human-readable diffs, I think a tool is very much needed.

For https://viewsourcecode.org/snaptoken/kilo/02.enteringRawMode... , the code is kept in a git repo where each commit is a step in the tutorial. This way steps can be modified, reordered, or split into more steps using git interactive rebase (git rebase -i).

I'm working on a tool which abstracts away git rebase, and gives you a nicer interface for manipulating the series of steps in your tutorial. For example, you can run `leg 3` to checkout step 3, make edits to it, and then run `leg amend` to apply the changes, resolving conflicts as the changes make their way through the rest of the tutorial's steps.

The tool is still in very early development, but here's a quick tutorial to get a better idea of how it works: https://github.com/snaptoken/leg/blob/master/TUTORIAL.md

Also, I'm playing around with a "literate diff" file format that might be of interest: https://github.com/snaptoken/tgc-tutorial/blob/master/doc/02...

1 comments

> I'm working on a tool which abstracts away git rebase

This is 99% of what I need! In the best case it's just files/folders I can edit manually or with the help of a CLI.

> The tool is still in very early development, but here's a quick tutorial to get a better idea of how it works: https://github.com/snaptoken/leg/blob/master/TUTORIAL.md

Now, if those diffs are rendered nicely and the splitting up of a step into multiples (or: explain separate parts of one step) works, I think that really is 99% of what I need. The 1% being the grouping of steps into a chapter and some other small things probably