Is there an easy way to find the SHA1 of the first commit in a project with a long history with git?
+5
A:
Just off the top of my HEAD, this should get one of the 'first' commits of the current branch.
git rev-list --reverse HEAD | head -1
(If the branch contiains two unrelated branches which have been merged together, it's not guaranteed which root you will get but you could use --date-order
to select the oldest.)
Charles Bailey
2010-07-17 08:06:09
yours is better :-)
Rufinus
2010-07-17 08:09:09
How about `git rev-list --reverse --max-count=1 HEAD`?
bstpierre
2010-07-19 02:47:08
Arrgh, I should test before I post. :) Apparently the count is applied first, so that just gives the most recent commit...
bstpierre
2010-07-19 02:53:01