Re: How to find where a branch was taken from.
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 21, 2008, 09:13 UTC
- Message-ID
- <7v4pb0qw28.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <47E37A63.9070209@glidos.net>
Paul Gardiner <osronline@glidos.net> writes:
Show 7 quoted lines
> 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.