Junio C Hamano <gitster@xxxxxxxxx> writes: > Paul Gardiner <osronline@xxxxxxxxxx> 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. Having said that, have you tried: $ git reflog show that_local_branch and looked for "branch: Created from blah"? -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html