Live data from Hacker News

Git's initial commit

github.com

61–70 of 128 posts

Re: Git's initial commit

#61
post #10

Following the tradition of sports, I propose that commit id e83c5163316f89bfbde7d9ab23ca2e25604af290 be officially retired.

I 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.

While 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.

Re: Git's initial commit

#63
Does 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)

Re: Git's initial commit

#64
post #63

Does 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)

You 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.

Re: Git's initial commit

#66

Is 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.

In the C grammar, braces denote compound statements. Control flow statements can take any type of statement as their body rather than just the compound variety.

It confuses me that it doesn't work for functions. like

    int main() return 0;

Re: Git's initial commit

#67
post #17

Is 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.

It's pointless to argue over these kind of things. Every major project/company has their own codified code style guide, and if you want to contribute/earn your salary then you must follow that style guide to the T. Here's the relevant quote from the Linux kernel coding style[0]: Do not unnecessarily use braces where a single statement will do. if (condition) action(); [0] https://www.kernel.org/doc/Documentation/Codi…

I see merit in both sides of the debate. As long as the style is consistent, it should be legible. It is an argument similar to vi versus Emacs -- both can be right. It is more important to be consistent through a project. Adopt one style.

From this day forward, let us proclaim to always use brackets; so that intent is more obvious to the reader.

Re: Git's initial commit

#68
post #50

It's so short. The readme is the best explanation of git I've seen.

Does 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?

One noteworthy difference is that in the original repository format, a tree object was just a list of named blobs. Nowadays each subdirectory of a tree is its own nested tree object, which means that when you're comparing two trees, you can skip over the directories that are identical.

I'm not sure when that change was made but it must have been very early on, because the repository format has been basically stable for many years now.

Re: Git's initial commit

#69
post #63

Does 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)

No, 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)

Re: Git's initial commit

#70
I 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.
Post reply on HN