Checking out a project's first commit with git

Is there an easy way to find the SHA1 of the first commit in a project with a long history with git?

  • How Should I Handle a Plugins Repo Using Git?
  • Maintaining a changelog.txt file in a DVCS
  • DVCS Choices - What's good for Windows?
  • is `hg forget` the same as `git rm --cached`?
  • Merges between two branches in two directions - any good reason or completely forbid?
  • Is it possible to drop a single file from git stash?
  • Why does Monodevelop ask me for a ssh key password when it is registered in ssh-agent
  • How to make a pre-commit hook that prevents non-UTF-8 file encodings
  • Remove unused assets from git history
  • Git recover uncommitted changes
  • How to batch-replace *all* instances (content, filenames and commit messages) of *Foo* to *Bar* in a repo in a single, simple step?
  • git archive with unstaged changes
  • 2 Solutions collect form web for “Checking out a project's first commit with git”

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

    git log --reverse | head -n1
    
    Git Baby is a git and github fan, let's start git clone.