News for hackers. Stuff that matters.
Re:Show HN: First Commit – find the first commit of any GitH... by jordanpg on Sunday November 22, 2015 @11:50AM (#10610573)
Am I missing something?

Why is this tool interesting? Or, why is this tool useful?

Wasn't this already pretty easy to find if one was so inclined?

Re:Show HN: First Commit – find the first commit of any GitH... by lol768 on Sunday November 22, 2015 @12:16PM (#10610658)
From what I can see following a quick cursory glance at the commit history page for quite a large project (https://github.com/twbs/bootstrap/commits/master) it's somewhat difficult to jump to the last page (earliest in terms of when hey were made) of commits. That is unless I'm missing something obvious, of course.

Sure, you can click older a bunch of times but it doesn't seem like there's a button to jump to the last page of commits. I guess you could clone the repo and look yourself using git log but this can be something of a hassle and probably wouldn't always be possible depending on the device (I'm thinking mobile devices, tablets etc).

You could probably guess a large page number, use it in the commit history URL and chop it in half repeatedly until you don't get a 404 and then repeat from there to try and find the last page of commits. Ultimately this is an issue with how GitHub's commit history is designed though.

Re:Show HN: First Commit – find the first commit of any GitH... by JasperBall on Sunday November 22, 2015 @12:23PM (#10610683)
?

Just do something like:

    git rev-list --max-parents=0 HEAD
Re:Show HN: First Commit – find the first commit of any GitH... by baby on Sunday November 22, 2015 @02:28PM (#10611117)
This command doesn't make any sense to me. That's why I hate using git...
Re:Show HN: First Commit – find the first commit of any GitH... by parennoob on Sunday November 22, 2015 @03:28PM (#10611364)
Let me attempt an explanation.

'git rev-list' will give you the SHA-1 hashes of all the commits reachable from a given commit. So 'git rev-list HEAD' is going to give you all commits reachable from HEAD, i.e. your latest one all the way to your first commit. After that, there's a bunch of ways you could filter that. For example, you could run 'git rev-list HEAD | tail -1' to get the hash of the first commit, and now all you need to do to show the whole diff is pipe it to 'xargs git show' (xargs reads from stdin and uses that as the argument to whatever comes after it.

The grandparent comment uses a slightly interesting trick – he/she used the built-in '--max-parents' filter. '--max-parents' limits the number of parent commits. For example, a merge has 2 or more parent commits, so the '--max-parents=1' option will exclude all merge commits. What commit has no parents? Why, the first commit of the repo, of course.

Hence, the command 'git rev-list --max-parents=0 HEAD | xargs git show'.

Re:Show HN: First Commit – find the first commit of any GitH... by yawaramin on Sunday November 22, 2015 @04:51PM (#10611638)
It's a query of the git commit history. List all commits which are direct or indirect ancestors of the `HEAD` (currently checked-out) commit, and which themselves don't have any ancestors (parents).

Personally, I would have used `master` instead of `HEAD` because any commit in git can be checked out, but `master` is highly likely to be the main line of development and thus be descended from the true first commit of the repository.

Re:Show HN: First Commit – find the first commit of any GitH... by sdesol on Sunday November 22, 2015 @07:16PM (#10612130)
Commits browsing/discovery on GitHub and on every other Git hosting site have always been rudimentary and I hope to change this with my chrome extension. With this extension, you should be able to find what you need faster on GitHub's commit page.

Here is an example of how you can quickly identify the first commits

http://imgur.com/oLveNGc

You basically scroll the chart to the furthest left.