From: Woody Wu <narkewoody@gmail.com>
To: Seth Robertson <in-gitvger@baka.org>
Cc: git <git@vger.kernel.org>
Subject: Re: Find the starting point of a local branch
Date: Mon, 24 Dec 2012 15:31:04 +0800 [thread overview]
Message-ID: <20121224073103.GA10793@zuhnb712> (raw)
In-Reply-To: <201212240409.qBO49wkV020768@no.baka.org>
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. With the method of 'git
merge-base', I have to remember a branch tree in my brain.
But thanks anyway, I see you guys's discussions and it's a little hard
to understand to me at the moment. Currently, I still have to use gitk
with narrowed outputs.
> Note that this is the *last* divergence. If your branch diverged and
> merged previously that will not be reported. Even worse, if you did a
> fast-forward merge (I recommend against them in general) then it is
> impossible to discover about what the independent pre-merge history
> was really like.
>
> -Seth Robertson
--
woody
I can't go back to yesterday - because I was a different person then.
next prev parent reply other threads:[~2012-12-24 7:41 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
2012-12-24 7:31 ` Woody Wu [this message]
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=20121224073103.GA10793@zuhnb712 \
--to=narkewoody@gmail.com \
--cc=git@vger.kernel.org \
--cc=in-gitvger@baka.org \
/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).