23 ms·
Git's initial commit
- deleted 12y ago[deleted]
- brandonbloom 12y agoI love checking out very early versions of projects. You often get to see the essence before the real world came in and ruined the beauty of it.
- akkartik 12y agoI do this as well. It really should be more widely broadcast. (I've also spent some time thinking about how it's kind of a hack, and what we can do to make it better: http://akkartik.name/post/wart-layers http://akkartik.name/post/wart-layers)
- Monkeyget 12y agoThere is The Architecture of Open Source Applications series of book http://aosabook.org/en/index.html http://aosabook.org/en/index.html were one of the author of the software explain the essence of the program.
- RexRollman 12y agoI know what you mean. The SystemD controversy motivated me to take a look at the initial version of NetBSD's init rc script, which was nicely simple.
- Fizzadar 12y agoGreat to see the original command set, and the title of course: "GIT - the stupid content tracker"
- derekp7 12y agoIf I recall, Linus was highly pissed at the time he wrote GIT. Lots of his comments at the time were meant as a slam against the guy who was reverse-engineering the Bitkeeper protocol, which resulted in the license for Bitkeeper getting yanked for the kernel project. I wonder if Linus is still angry with Tridgell?
- sjwright 12y agoI've been in the situation where a combative party has spurred me on to do some of my best work. I doubt Linus holds a grudge... and considering the consequences I wouldn't be surprised if he wrote a tounge-in-cheek thank you letter!
- byteCoder 12y agoFollowing the tradition of sports, I propose that commit id e83c5163316f89bfbde7d9ab23ca2e25604af290 be officially retired.
- SwellJoe 12y agoEvery commit id is pretty much automatically retired. The odds of collisions in our lifetime are pretty small. Or am I over-thinking it?
- traek 12y agoYeah, I'm pretty sure it was a joke.
- VieElm 12y agoI was under the impression that git hashes are generated based on the contents in a commit. If that's true you cannot retire them. They're not random.
- Iburinoc 12y agoWhile that is true, part of the contents that is hashed is the time of commit. Therefore if you (somehow...) managed to get that hash, you could just reset and commit again. Or amend. In any case, I believe he was joking. The odds of a sha1 collision are very very low.
- sytelus 12y agoVery low indeed. Chance of SHA1 collision is of the order of 2^52. One person explained it this way: Chance of everyone currently on Earth winning a jackpot in their lifetime is actually higher than a single random SHA1 collision. It should be actually mind boggling how many of the software systems and algorithms rely on hashes and them being not collided.
- yuhong 12y ago
- fivedogit 12y agoThread from 829 days ago. https://news.ycombinator.com/item?id=4395014 https://news.ycombinator.com/item?id=4395014
- benihana 12y agoIs there a reason there aren't any braces around single-line if statements? Is that a C thing? It seems kind of inviting to bugs to me.
- workingandtired 12y agoIt's a C-style language syntax option. If it's only a single line in after the if, the braces are optional. I've also seen it in C++ and PHP. Whether or not it's sloppy is up for debate and just a matter of personal preference.
- solistice 12y agoC# also has it, and i've heard Java has got it as well, but I've never tested it in the latter. I personally like being able to do it since it allows me to do away with the 2 extra lines auto indent puts in if i add brackets. That's a 50% reduction for a 4 line if. Maybe I should just buy a bigger monitor.
- workingandtired 12y agoThe lead programmer at my last job encouraged us to use it as a way to make sure our conditionals & foreach loops (PHP programmer) weren't doing too much. If we had to use braces, it was a sign to check it out and see if it could stand some refactoring.
- tenementfunster 12y agoSounds a tad inane.
- seanmcdirmid 12y agoI use a plugin called littlebrace for visual studio, which reduces brace lines to like 3 pt font. My C# code has started looking like Python :)
- 12y ago
- deleted 12y ago[deleted]
- jeffreyrogers 12y agoInteresting fact about Git is that it was self hosting in two weeks, IIRC.
- TazeTSchnitzel 12y agoHow can something that isn't a programming language be self-hosting?
- jonesetc 12y agoOverloading the term. The OP presumably meant that the source for git was under git source control.
- jeffreyrogers 12y agoYes, that's what I meant.
- deleted 12y ago[deleted]
- vacri 12y ago'Hosting' means 'contain', 'serve'. A building can host a department or a convention, and a married couple can host a dinner party, with neither being required to be a webserver or programming language.
- tripa 12y agoTo add to that, IMHO self-hosting for VCSs is closer to the original meaning of the phrase than for compilers.
- kazinator 12y agoVersion control systems are self-hosting when they are used to manage the primary repository of their own source code. This shows confidence because if the program breaks, then it breaks its own configuration management, which could be a headache to unravel. For example if the repository format changes, then the change has to be managed so that the old versions remain accessible through the new version of the software. If this is not managed, and old compiled binaries of the version control system disappear from existence, then it may become impossible to recover the old sources. Thus, successfully self-hosting a version control system is some measure of evidence that the developers know what they are doing and can manage the changes. (And thus they understand change management and we can trust them to be working on version control software.) http://en.wikipedia.org/wiki/Self-hosting http://en.wikipedia.org/wiki/Self-hosting "Other programs [than compilers] that are typically self-hosting include kernels, assemblers, command-line interpreters and revision control software.
- zabcik 12y agoWhy are there multiple main() functions? I've never seen this style before. Is it multi-process?
- GauntletWizard 12y agoThere's a bunch of different utilities in there. Each has it's own main() function, and they're compiled into a bunch of binaries.
- taurath 12y agoCould just be initializers for different modules maybe?
- Svenstaro 12y agoThere are multiple main() functions because there are multiple programs! Check out https://github.com/git/git/commit/e83c5163316f89bfbde7d9ab23ca2e25604af290#diff-b67911656ef5d18c4ae36cb6741b7965R4 https://github.com/git/git/commit/e83c5163316f89bfbde7d9ab23...
- andrewchambers 12y agoLook at the makefile, it just has a command line program for each basic operation.
- jordigh 12y agoWell, while we're looking at FIRST POSTS, here's Mercurial's, self-hosting a month after git, and like git, also created to replace bitkeeper: http://selenic.com/hg/rev/0#l10.1 http://selenic.com/hg/rev/0#l10.1 The revlog data structure from then is still around, slightly tweaked, but essentially unchanged in almost a decade.
- coldpie 12y agoMercurial is impressive for making Git's UI look intuitive.
- EGreg 12y agoOther way around
- coldpie 12y agoC'mon, man, you make branches by cloning the repository[1]. That's insanity. [1] http://hginit.com/05.html http://hginit.com/05.html
- jordigh 12y agogit at revision 0 worked the same way. You can see that there are no references in git at that time either. They're both copying bitkeeper, which worked the same way. Nowadays git has references (branches), and hg has bookmarks which are the same, plus hg also has the option to label every commit with a permanent branch name. They also still have branching-by-cloning, and if you listen to Linus's original Google code talk about Git, you can see that he conflates "branch" and "clone" because that's what he originally envisioned! Even in 2007 he was still thinking in bitkeeper terms too. I bet that branching with references was Junio Hamano's idea, after Linus did the code hand-off. I find branching-by-cloning a bit more natural in hg, because you can push to any repo. It's useful for quick, throwaway, local, easy testing out of ideas. In git, you can only push if your push doesn't modify HEAD, which typically translates into only being able to push to bare repos.
- hyp0 12y agoIt's so short. The readme is the best explanation of git I've seen.
- jastanton 12y agoDoes anyone know if the structure of git has changed much? I would like to read this thinking this is pretty close to the current implementation but I would have no idea. anyone?
- asdfaoeu 12y agoYou can just see the structure with git cat-file -> % git cat-file -p 8c48d1a36c3d11db44c75a431d4f09cb0035222f tree 288c2d5379768f685f391bdbffd31b8965318c63 parent 002ae35061beef02453b7fb1045a50fa2f7f30f8 author Denis Bilenko <denis.bilenko@gmail.com> 1246939605 +0700 committer Denis Bilenko <denis.bilenko@gmail.com> 1246939605 +0700 MANIFEST.in: include libevent.h and libevent-internal.h -> % git cat-file -p 288c2d5379768f685f391bdbffd31b8965318c63 100644 blob 6e543dc13df1b556fd95530061ac0c77a9178309.hgignore 100644 blob 79c7beb2227ce149c7a71e58e2f7379071b7a189MANIFEST.in 100644 blob 0d05178544942a035a82599900bec27fbac1c9c5README.eventlet 040000 tree edb8f37fa622315dcf7bf4f7316d5e85c48cfdbdexamples 040000 tree 64cf252d77a4162099442bb0153985fc20ed5ba3gevent 040000 tree 261052e04b4aece469b2e767e394aafbc9d88a32greentest 100644 blob 488e805c563dfeeb6af5e7a1a8953b706d9676e3setup.py -> % git cat-file -p 6e543dc13df1b556fd95530061ac0c77a9178309 syntax: glob *~ *.pyc *.orig dist gevent.egg-info build htmlreports results.*.db gevent/core.so And yeah it's still very similar though it currently doesn't store the objects individually but rather packs them together.
- alblue 12y agoI wrote about the format of git trees (and other object types) here: http://alblue.bandlem.com/2011/08/git-tip-of-week-trees.html http://alblue.bandlem.com/2011/08/git-tip-of-week-trees.html
- coldpie 12y agoWhile it looks arcane, this comes in handy enough when grepping through history that I actually have "cat-file -p" aliased to 'cf'.
- justintbassett 12y agoI wonder what the first commits for big sites/projects look like?
- josephcooney 12y agoI tried to compile a list of a few of them a while ago: http://jcooney.net/post/2011/06/22/First-Check-in-Comments-from-Popular-Open-Source-Projects.aspx http://jcooney.net/post/2011/06/22/First-Check-in-Comments-f...
- d0m 12y agoI've read so many git tutorials, I wish I had seen that README file before.
- danra 12y agoThis. I find that learning from original documentation tends to be much more efficient than learning from third party blogs/tutorials which try to "simplify" things, and usually do the opposite.
- hw 12y agoDoes Github offer an easy way to get to the first commit of a project? Traveling page by page back in time is time consuming (yeah, i did that)
- isbadawi 12y agoYou can go to the project's network graph (append /network to the url) then press shift ←. If the project has a lot of forks like git/git does it won't work though.
- ChristianBundy 12y agoNo, but if you have the full history you can grab it with a shell command. echo https://github.com/git/git/commit/$(git log --pretty=format:%H | tail -1)
- royragsdale 12y agohttps://github.com/git/git/commits?page=1091 https://github.com/git/git/commits?page=1091 If you want to see the commits going forward from here.
- JSno 12y agoI found so many JAVA _PROGRAMMERS_ here asking stupid c question. What a world! people don't know C are building software. That's why so many Indian java coders in US. shameful.
- dirtyaura 12y agoI only realised reading the README that git is a great lesson in branding.
- DodgyEggplant 12y agoThis is a great lesson in writing focused & succinct specs, when one clearly sees what his/her program is going to do.
- afandian 12y agoMy god... the comments. Looks like the reddit culture (i.e. fun for in jokes but not particularly professional)
- scintill76 12y ago"A marathon of clicking 'next page,' but the view is worth it." So, this commenter practically worships git, but apparently doesn't actually understand it well enough to know a better way to find the hash of the first commit and punch that into Github. Or, it was just a joke and they got there the quick way, but still felt obliged to post a dumb joke to inflate their own ego by "leaving their mark" on git. Maybe I'm being too mean, but yeah, I also think a lot of the comments are pointless.
- nathanvanfleet 12y agoIt's probably the "I F*cking Love Computer Science" sub-reddits.
- afandian 12y agoIt's lots of subreddits. There are some serious ones, but the main-stream ones all contain the usual memes, injokes etc. I enjoy diving into reddit every now and again. But I use github for work (and code for fun, although it's 'serious' fun). Although open-source collaboration is a fundamentally social activity, I think that mixing source control with a social network does inevitably leads to these kinds of comments. And I wouldn't dream of mixing that up with my professional identity. Maybe it's just a marker of how versatile github is, and the community of people who write programs and put them in source control.
- dyeje 12y agoAFAIK you can't search by commit hash. You have to do some URL manipulation.
- kachnuv_ocasek 12y ago
- EGreg 12y agoLinus wrote: * +Side note on trees: since a "tree" object is a sorted list of +"filename+content", you can create a diff between two trees without +actually having to unpack two trees. Just ignore all common parts, and +your diff will look right. In other words, you can effectively (and +efficiently) tell the difference between any two random trees by O(n) +where "n" is the size of the difference, rather than the size of the +tree. * Um, What?
- pja 12y agoSince a git hash points to a sorted list of filenames and content hashes, to diff two git commits you lookup the commit objects by their hash, run down the resultant list of filename/hash pairs & then only lookup & diff the content of those files that have differing hashes (if they have the same hash, they must have the same content according to the git data model, so they can be safely ignored). Hence diffing arbitrary commits with git is always O(N) in the number of changed files, regardless of the number of interstitial commits.
- throw_away 12y agoIn particular he's saying that for a tree, you can quickly skip sub-trees if they are the same, regardless of how deep they go. Kind of like a Merkle tree: http://en.m.wikipedia.org/wiki/Merkle_tree http://en.m.wikipedia.org/wiki/Merkle_tree I'm no git internals expert, but I suspect for a flat list of files the complexity is still O(n) where n is the number of files (not changes) because at very least you must check that n checksums are the same.
- pja 12y agoI'm no git internals expert, but I suspect for a flat list of files the complexity is still O(n) where n is the number of files (not changes) because at very least you must check that n checksums are the same. Sure. The constant factors make a huge difference though - even if you've cached all the data in memory walking all those structures and diffing the actual file data is going to be enormously slower than simply walking a list of hashes, so you're really saying that the total time is big * O(number of files changed) + small * O(number of files). If small*N ~ big then it's reasonable to just disregard that cost - it's going to be lost in the noise.
- Jackcor 12y agoDid all of the inital commit code is written by Linux Torvalds ?
- gpvos 12y agoYes. The interesting thing is actually that it isn't that much code.
- tempodox 12y agoCode comment about git: stupid. contemptible and despicable. That sums it up quite well. Every day I pay thanks to The One Who Programmed Me that my workflow doesn't put me in need of that shitload of crap that is git. I pity those who do need git.
- stinos 12y agoMaybe I've been drilled too hard by a couple of programming gurus, but I immediately noticed there are quite a lot of repeated yet unnamed magic constants in the (otherwise pretty clean) code. According to wikipedia [1] the rule to not use them is even one of the oldest in programming. Curious what kind of profanity Linus would come up with when confronted with this :] [1] https://en.wikipedia.org/wiki/Magic_number_%28programming%29#Unnamed_numerical_constants https://en.wikipedia.org/wiki/Magic_number_%28programming%29...
- hnmcs 12y agoGotta love the fact that there are open pull requests. https://github.com/git/git/pulls https://github.com/git/git/pulls
- dbdr 12y agoWhere are the tests?