Reference Git branch start commit

I am trying to find how to reference branch start commit from script. I mean the commit sha at which branch was forked.

Moreover I expect it work for history made from svn repo.

  • How to find commit SHA1 of a tree containing a file containing a given string
  • What to do after typing in commit message for git?
  • How to make a git rebase and keep the commit timestamp?
  • File not shown in git diff after a git add. How do I know it will be committed?
  • How to edit Git “add patch” hunks/diffs/lines during selective staging?
  • How to find commits by a specific user in Git?
  • This post just gives first commit of repo creation and not feature branch start commit.

  • private mercurial/git branch for backup?
  • Is this git's correct behavior for “git add” with subfolders?
  • How can I push my existing Git repository to Team Foundation Service
  • Using Git on a local network. Cloning from one repository to multiple users, pushing back to remote and being able to see updates from all clones
  • git rebase: copy instead of moving
  • Bower “Git not in the PATH” error
  • One Solution collect form web for “Reference Git branch start commit”

    What you’re looking for is the command merge-base:

    git merge-base master feature-branch

    will print the best common ancestor of those two branches, i.e. where they forked apart. (The documentation has pretty pretty pictures to clarify some of the interesting cases)

    Git Baby is a git and github fan, let's start git clone.