Search code examples
gitgit-branch

git how to find commit hash where branch originated from


Pretend I branched from my master branch to a topic branch, and then I did a few commits on my topic branch. Is there a command that tells me the commit hash on the master branch that my topic branch originated from?

Ideally, I wouldn't have to know how many commits I've made ( trying to avoid HEAD^5 ).

I've googled and SO'd around and can't seem to land on the answer. Thanks!


Solution

  • use git merge-base master your-branch to find the best common ancestor between two branches (usually the branching point).