Re: How to find where a branch was taken from.
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:44:24
Paul Gardiner [off-list ref] writes:
I need a command that will find the remote branch from which the currently checked out branch was started. I don't know git very well, and the only way I can think to do it so far is to iterate over the remote branches and find the one for which git-rev-list <branch>..HEAD gives the smallest number of objects. I'm guessing there must be a better way. Any ideas?
There will be _no_ way. It is simply impossible.
$ git checkout -b my-new-branch origin/somerandombranch~27^2^2~23
is a perfectly valid way to create a new branch.
You would probably want to re-think in a bigger picture, _why_
you would want to find such information, in other words, how you would
want to use the information (if such a thing were possible) to solve
_what_ problem. That true problem you did not mention (and assumed that
"the remote branch the branch was branched from" would be a good tool to
solve it) might have a better solution.