On Sun, Dec 23, 2012 at 11:31 PM, Woody Wu <narkewo...@gmail.com> wrote:
> On Sun, Dec 23, 2012 at 11:09:58PM -0500, Seth Robertson wrote:
>>
>> In message <20121224035825.GA17203@zuhnb712>, Woody Wu writes:
>>
>>     How can I find out what's the staring reference point (a commit number
>>     or tag name) of a locally created branch? I can use gitk to find out it
>>     but this method is slow, I think there might be a command line to do it
>>     quickly.
>>
>> The answer is more complex than you probably suspected.
>>
>> Technically, `git log --oneline mybranch | tail -n 1` will tell you
>> the starting point of any branch.  But...I'm sure that isn't what you
>> want to know.
>>
>> You want to know "what commit was I at when I typed `git branch
>> mybranch`"?
>
> Yes, this is exactly I want to know.
>
>>The problem is git doesn't record this information and
>> doesn't have the slightest clue.
>>
>> But, you say, I can use `gitk` and see it.  See?  Right there.  That
>> isn't (necessarily) the "starting point" of the branch, it is the
>> place where your branch diverged from some other branch.  Git is
>> actually quite able to tell you when the last time your branch
>> diverged from some other branch.  `git merge-base mybranch master`
>> will tell you this, and is probably the answer you were looking for.
>
> This is not working to me since I have more than one local branch that
> diverged from the master, and in fact, the branch I have in question was
> diverged from another local branch.

As Jeff mentions in a later message, "git pull --rebase" would
probably do what you want. It works with local branches too.

I once tried to add the same cleverness that "git pull --rebase"
directly in "git rebase" [1], but there were several issues with those
patches, one of was regarding the performance ("git pull --rebase" can
be equally slow, but since it often involves network, users probably
rarely notice). I think it would be nice to at least add it as an
option to "git rebase" some day. Until then, "git pull --rebase" works
fine.

 [1] http://thread.gmane.org/gmane.comp.version-control.git/166710
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to