0

In git how to find the name of the branch from which my actual branch created? Example: I created my development branch(dev-feature) from integration branch(dev-int). How to trace the integration from feature branch?

Prasad
  • 1,089
  • 13
  • 21
  • Possible duplicate of [Find the parent branch of a Git branch](https://stackoverflow.com/questions/3161204/find-the-parent-branch-of-a-git-branch) – phd Oct 19 '18 at 10:44
  • https://stackoverflow.com/search?q=%5Bgit%5D+find+parent+branch – phd Oct 19 '18 at 10:44

1 Answers1

1

You can't.

You branch off from a commit, not from a branch. Branch is just a temporary tag that moves with commits while active.

Say there's a commit 0123456 where you have branch A and B. You make branch C. Which branch did you branch off of? The real answer is "neither" - you branched off from 0123456.

Also, branches don't remember where they started; the only thing you can do is trace the history back, and find where that history attached to the history of another branch. For example, to see where exactly def-feature history meets dev-int history,

git merge-base def-feature dev-int
Amadan
  • 191,408
  • 23
  • 240
  • 301