From: Martin von Zweigbergk Date: Fri, 28 Dec 2012 06:38:25 GMT Subject: Re: Find the starting point of a local branch Message-ID: In-Reply-To: <20121228051514.GA4028@zuhnb712.ap.bm.net> On Thu, Dec 27, 2012 at 9:15 PM, Woody Wu wrote: > On Mon, Dec 24, 2012 at 09:24:39AM -0800, Martin von Zweigbergk wrote: >> On Sun, Dec 23, 2012 at 11:31 PM, Woody Wu wrote: >> > >> > 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 think what 'git pull --rebase' would do is to fetch from the origin > and do a 'git rebase'. Not if the configured upstream is a local branch (see the "branch..*" configuration variables). In that case it will just rebase the local branch onto the new position of its upstream. If the upstream is not configured, I believe you can still do "git pull --rebase . ". > On one hand, I don't understand 'git rebase' so > much from the manual, ont the other hand, I did not get the point why > 'git rebase' has something to do with the thing I want to do (what I > want is just query some kind of history information). I may have misunderstood or assumed things incorrectly that you wanted to rebase the commits on your branch. So why do you want to know? (Please ignore me if this was answered elsewhere in the thread that I might have missed.) Anyway, to answer your question, you could use a method similar to what "git pull --rebase" uses internally to figure out the branch point: git merge-base $(git rev-parse ) $(git rev-list -g ) Hope that helps