git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Cc: Seth Robertson <in-gitvger@baka.org>,
	Woody Wu <narkewoody@gmail.com>, git <git@vger.kernel.org>
Subject: Re: Find the starting point of a local branch
Date: Mon, 24 Dec 2012 10:34:15 -0500	[thread overview]
Message-ID: <20121224153415.GA28670@sigill.intra.peff.net> (raw)
In-Reply-To: <CACsJy8Dt94XLSa8Sg3T0URJYG9cHD_sUySuhm3Vu4ESy-VrXag@mail.gmail.com>

On Mon, Dec 24, 2012 at 06:16:05PM +0700, Nguyen Thai Ngoc Duy wrote:

> > 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

  reply	other threads:[~2012-12-24 15:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-24  3:58 Find the starting point of a local branch Woody Wu
2012-12-24  4:09 ` Seth Robertson
2012-12-24  5:28   ` Nguyen Thai Ngoc Duy
2012-12-24  5:34     ` Tomas Carnecky
2012-12-24  5:45       ` Nguyen Thai Ngoc Duy
2012-12-24  6:27         ` Junio C Hamano
2012-12-24 11:21           ` Nguyen Thai Ngoc Duy
2012-12-24 19:10             ` Junio C Hamano
2012-12-25  1:09               ` Nguyen Thai Ngoc Duy
2012-12-24  6:19     ` Jeff King
2012-12-24 11:16       ` Nguyen Thai Ngoc Duy
2012-12-24 15:34         ` Jeff King [this message]
2012-12-24  7:31   ` Woody Wu
2012-12-24  9:12     ` Kevin
2012-12-24 17:24     ` Martin von Zweigbergk
2012-12-28  5:15       ` Woody Wu
2012-12-28  6:38         ` Martin von Zweigbergk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121224153415.GA28670@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=in-gitvger@baka.org \
    --cc=narkewoody@gmail.com \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).