Re: tracking branch for a rebase
- From
Michael J Gruber <git@drmicha.warpmail.net>
- Date
- Sep 4, 2009, 14:31 UTC
- Message-ID
- <4AA124DD.1030208@drmicha.warpmail.net>
- In-Reply-To
- <20090904135414.GA3728@honk.padd.com>
Pete Wyckoff venit, vidit, dixit 04.09.2009 15:54:
Show 12 quoted lines
> I received an interesting question today. > > If "git pull" knows what remote tracking brach to pull from, > why doesn't "git rebase" automatically know I want to rebase > on top of my remote tracking branch? > > He had done a "git remote update", reviewed the changes, and now > wants to rebase his changes on top of the new upstream. > > I told him about git pull --rebase, and branch.name.rebase, > but didn't have an easy answer to the "what is my remote tracking > branch" question in this case.
I guess he knows that branch if he reviewed it... More seriously,
git for-each-ref --format='%(upstream)' refs/heads/hisbranch
will return the upstream of hisbranch.
Show 5 quoted lines
>
> All the information is in git config branch.name.{remote,merge},
> but I can't find anything that just answers that question. Nor
> did I have a good answer for why "git rebase" doesn't just default
> to rebasing the current branch on top of the tracking branch.Maybe because nobody has cared. Doing a "git pull --rebase" is not equivalent (it may fetch more refs), but close enough for many people.
There was an initiative by Dscho a while ago to introduce a shortcut for the upstream, which was dwarfed by the lack reserved characters for refnames. Maybe 1.7 time frame would be a good time to change this?
Making this the default for rebase without arguments may meet some objections (oh no, I didn't mean to rebase), but I guess it's worth trying.
Michael