This is nice. One pet peeve is that (as far as I know, I'm really not an expert) Git repos don't actually have names. The first thing the article does when implementing them is to give them names, which I thought was a bit jarring.
I actually think the namelessness of the repos is one of the things that are unexpectedly cool about Git.
I appreciate the work that has gone into this, and think it is a great starting point for an interesting tutorial about git.
My concern is that the tutorial ignores or discards ideas essential to how git works, and what makes git different to other version control systems.
As other comments have said, this is showing 'just another SCM system' without illuminating the design decisions that make git different.
For example, in git it is extremely important that commit objects have a unique identifier for any given working directory, history, and commit meta-data. Without this guarantee the distributed architecture of git is (almost) impossible to implement.
In the commit section the tutorial states:
a simple Commit class would have ... a change containing the snapshot of change made. Understanding how a change is actually stored is beyond the scope of this implementation.
This terminology is misleading at best, and skips over a very important concept in how git actually works. The phrase 'snapshot of change made' is misleading, as a commit doesn't contain any explicit information about changes made. Instead, the staged files in the working directory are saved into a 'blob' store, a tree structure is created to represent the directory structure, and a reference to the tree is saved in the commit object. I understand that all this is outside the scope of the tutorial, however an outline of how commits work is important information for anyone trying to understand how git works. For example, the storage format is the primary reason operations in git are so fast.
Again, I like the tutorial, but if it wants to teach about git, as opposed to other version control systems, it needs to ensure the key git concepts are maintained.
I 100% agree. It's always great to try to implement complicated things, but it misses the point if what you're implementing is nothing like the original system. You aren't learning how Git works if you do it that way are instead just mimicking API names
Reiterating on my point again, the aim of this project is not to replicate Git. JS-Git (https://github.com/creationix/js-git) does that.Here I am trying to code basic concepts relaxing complex stuff so that reader can focus & visualize more abstract concepts. I have tried to bring in concepts as and when wanted instead of just overloading the reader with complex stuff all at once.
Which is fine. But you're specifically saying that you are building Git to learn how it works. All I'm saying is, based on your wording, you need a disclaimer that this is not how Git works internally. You can already get the gist from a lot of the comments that they think they now know how Git works after reading this post.
I appreciate the effort and think it's a great idea to implement something your own way, I'm just trying to point out that you're saying this is how THE Git works, which it isn't. Nice write up as a whole though
A nice concept, but it doesn't really have much to do with Git. It's just another SCM system, and the concepts are just as applicable to e.g. Mercurial as Git. There are enough differences from Git to make it quite incompatible (named repository, incremented commit IDs, single parents et c.).
The point is to implement gradually. For example, in the concepts covered in part 1, multiple parents was not required, hence it was left. It should make sense to the reader why something was implemented and why it does what it does.
Its concepts might apply to other VCS. But that is immaterial, Git is what we are trying to understand here.
Tutorial looks awesome. It would be helpful if you would mention from the beginning that you will be implementing in JavaScript before reaching the code snippets.
I also attempted to understand git better by implementing it, but my (Haskell, uncompleted, abandonded) implementation was more concerned with getting all the on-disk representations right: http://evan-tech.livejournal.com/254793.html
A related good way of learning Git is to check out/checkout the very first commits of git made using git. I found the shear lack of code that a working system could be made of to be enlightening.
This is an excellent resource. On Bento, I have so many tutorials and walkthroughs on the basics of Git (it's a very readily accessible teaching opportunity) that it's gotten somewhat unwieldy. In many instances, some of the material is very base, and I've been looking for something more thorough without being too specialized.
This gives an excellent walkthrough of how Git works, but not only that, serves an excellent exercise on JavaScript. Bravo.
I'm not sure I quite agree. Use it, yes, but if you're using Git as a black box then you're much more likely to be frustrated by it than if you understand what's going on under the hood. I tend to point people at "Git from the bottom up"[0] -- it gives people the understanding they need to work out the effect they require, from which they can work out which set of commands will get them there.
Most people will not be using advanced functions though and if people generally understand how version control works, I don't think git is super hard to pick up and learning whilst doing is most effective for me.
From what it seems, I believe the objectives of both the projects differ greatly. js-git attempts to replicate the functionality of git entirely using Javascript, whereas this one is to make people learn and understand git using programming paradigms.
BINGO. I actually try to do this before job interviews: build a dumb version of one of their big products. I'm not even talking about something as sophisticated as this git project, I mean "build a dumb version".
Great work and keep continuing with the series. I understand this is not exactly the real git's inner working, but this series of articles may lead some other coder or hacker or other inquisitive mind to stitch together the missing part. That's the beauty of sharing!
Very nice. Basic reimplementation is always useful to visualize abstract concept like Git. Git can be hard to new comers, as it's not always obvious what commit/branch/push does. Thank you
Thank you, it's a very nice tutorial and I have not thought about this before (concept of trying to implement something you want to learn and get a better understanding of).
implementing git is an interesting approach to learning it.
i generally support this kind of stuff - however I think that this starts out implementing a source control solution rather than git in particular and its a shame that it follows git so closely later down the line in that regard (but completely understandable given the aim).
solving the problems for yourself you can get some insight into why git is the way it is (and svn, p4, hg, everyone else...)
I'm pretty sure the point of the article is to learn about how to use git by implementing its basic functionality. The point isn't to implement how git works.
On a side note, I'm always amazed when someone implements things that are complicated to me in a really understandable ways.
I actually think the namelessness of the repos is one of the things that are unexpectedly cool about Git.