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 use the default git commit message after resolving merge conflicts?
  • Show the progress of commiting
  • Git does not recognize new folder adds and its sub directories
  • Differences Between Fixup and Removing a Commit in Git Rebase
  • Git branch. How to assign a commit to a branch?
  • How to bring back my changes from some commits to the index?
  • This post just gives first commit of repo creation and not feature branch start commit.

  • Adding deep folders in git
  • Does Xcode 4 install git?
  • Can Heroku ignore git submodules on deploy?
  • How do I update submodule?
  • Very large TFS repo — <git tfs branch> from a subfolder
  • How to have a separate branch for tagged commits only?
  • 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.