On Fri, Mar 21, 2008 at 5:13 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote: > 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, [...] I frequently want to do this. Basically, I start from "some version" of the upstream program, and I put together some patches, then I want to use rebase to reorder and recombine them before I send them in. In order to do this, however, I'm forced to remember where I got my "original" version from, which isn't even that important. As the developer of a particular patch, all I *really* should have to know is: a) here are the things I added since I made my topic branch, and b) here is the branch I want to rebase them onto so I can submit my cleaned patches upstream. If git would explicitly track the rev at which my branch was created, it would mostly solve *my* problem here, even though I wouldn't know the *name* of the branch I branched from. Alternatively, we could avoid tracking anything extra at all. If git could suggest a branch or tag that mine is "currently closest to", ie., the one that has as many of the commits from my branch as possible (even if it has additional commits that I don't have), then that might be the branch I'm interested in. If not, I could use this comment repeatedly to produce a "chain of parent branches", one of which is probably the one I'm interested in. Have fun, Avery -- 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