Re: Find the starting point of a local branch
- From
Jeff King <peff@peff.net>
- Date
- Dec 24, 2012, 15:34 UTC
- Message-ID
- <20121224153415.GA28670@sigill.intra.peff.net>
- In-Reply-To
- <CACsJy8Dt94XLSa8Sg3T0URJYG9cHD_sUySuhm3Vu4ESy-VrXag@mail.gmail.com>
On Mon, Dec 24, 2012 at 06:16:05PM +0700, Nguyen Thai Ngoc Duy wrote:
Show 9 quoted lines
> > The reason that git does not bother storing "where did I start this > > branch" is that it is usually not useful. The right question is usually > > "what is the merge base". There are exceptions, of course (e.g., if you > > are asking something like "what work did I do while checked out on the > > 'foo' branch"). But for merging and rebasing, I think the computed > > merge-base is much more likely to do what people want. > > Rebasing is exactly why I want this. Merge base works most of the time > until you rewrite upstream (which I do sometimes).
True, although wouldn't you generally want to rebase it on top of the rewritten upstream in that case (which is what "pull --rebase" will do, by scanning the reflog for the last version of the upstream that you actually built on).
> There are also cases when I create a branch without upstream, or when
> upstream is renamed. Still, making "rebase -i --topic" == "rebase -i
> $(git merge-base HEAD @{upstream})" would be cool.Yeah. I usually just do "rebase -i @{upstream}" which picks the same commits, but moves to the updated version of upstream (IOW, I both rewrite and move forward at the same time). But there is value in rewriting without moving forward in many workflows. That seems like a sensible feature to me.
-Peff