From: Junio C Hamano Date: Fri, 21 Mar 2008 09:15:48 GMT Subject: Re: How to find where a branch was taken from. Message-ID: <7vzlssphdn.fsf@gitster.siamese.dyndns.org> In-Reply-To: <7v4pb0qw28.fsf@gitster.siamese.dyndns.org> Junio C Hamano writes: > Paul Gardiner 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 ..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. Having said that, have you tried: $ git reflog show that_local_branch and looked for "branch: Created from blah"?