←back to thread

848 points thefilmore | 3 comments | | HN request time: 1.257s | source
Show context
bandrami ◴[] No.43969975[source]
Pretty cool that Linus Torvalds invented a completely distributed version control system and 20 years later we all use it to store our code in a single place.
replies(29): >>43969999 #>>43970002 #>>43970008 #>>43970018 #>>43970019 #>>43970028 #>>43970031 #>>43970032 #>>43970036 #>>43970037 #>>43970142 #>>43970154 #>>43970198 #>>43970282 #>>43970314 #>>43970343 #>>43970418 #>>43970419 #>>43970431 #>>43970434 #>>43970451 #>>43970472 #>>43970541 #>>43970904 #>>43971268 #>>43971299 #>>43971387 #>>43971586 #>>43988717 #
lmm ◴[] No.43970037[source]
Turns out the important part wasn't the distributed-ness at all (unless you count being able to work offline). Many such cases.
replies(1): >>43970133 #
globular-toast ◴[] No.43970133[source]
Oh it is, but I think people forget what the distributed model gets you. It isn't just about having a completely decentralised workflow. When you clone a repo you have everything you need to keep working on that project. You have your own copy of all the branches which you are free to do whatever you want with. This is what makes it fast. Every clone has a brand new master branch and you never needed to ask anyone or get agreement to get your own branch to work on. Commits on your branch will never interfere with anyone else's work. You don't need to lock files and complete your work as quickly as possible. You can do as many commits as you like, a hundred in a day is not unheard of, because it's your branch. Previously people would commit once a day at most and sometimes not even until the end of the week, which is just unthinkable to a git user. A git clone is your own personal repo which allows you to use version control before you even share anything with anyone.
replies(2): >>43970273 #>>43970396 #
1. eru ◴[] No.43970396[source]
> You have your own copy of all the branches which you are free to do whatever you want with.

That's the default. But git would work just as well, if by default it was only cloning master, or even only the last few commits from master instead of the full history.

You can get that behaviour today, with some options. But we can imagine an alternate universe were the defaults were different.

Most of what you say, eg about not needing lockfiles and being able to make independent offline commits, still applies.

replies(1): >>43970659 #
2. globular-toast ◴[] No.43970659[source]
The point wasn't really about having your own copy of the commit history, it's about having your own copy of the refs (which is all a branch is in git). Basically, your master branch is not the same branch as GitHub's master branch or anyone else's. This is one of the things people don't really seem to understand about git. It means you don't have to do the "feature branch" thing, for example, you can just do commits on your master branch then submit a PR.
replies(1): >>43979359 #
3. eru ◴[] No.43979359[source]
Yes, branches are just mutable pointers. The commit history is an immutable tree and has a garbage collector to clean up.

Funny enough, this is more or less exactly the architecture some of those Haskell-weirdos would come up with. It's essentially a copy-on-write filesystem.

(Haskell people are weirdos compared to good old fashioned operating system people who use C as God intended.)