threads / discuss / 11657

git fetch+rebase on a local tracking branch

Subject: git fetch+rebase on a local tracking branch

## tl;dr

3 messages between Jan 17, 2008 and Jan 17, 2008.

replies: 2people: 2as markdown or json

Kevin Ballard· Jan 17, 2008, 17:24 UTC · lore

When I'm working on a local tracking branch, is there an easier way to do `git fetch && git rebase origin/branch`? I could imagine either a config value like branch.master.rebase = remotes/origin/master (although it would be nice to avoid duplicating the remote name, since we already have branch.master.remote), or perhaps a --rebase command to git pull such that it simply performs a rebase instead of a merge.

Is there some reason there isn't already a solution like this, or am I simply missing something?

One of the reasons I really want a hands-off solution to rebasing is I'm somewhat paranoid of accidentally rebasing from origin/master when I'm sitting on another branch. If my branch knows where it's supposed to rebase from in normal usage, that solves the problem.

I'd like to mention that the largest conceptual hurdle in migrating from another VCS is that pull and push are not opposite commands, and that when I'm, say, using a clone of the git repository, unless I'm an integrator I should always rebase instead of merge. Also, fetch+rebase is so common I'm surprised it doesn't already have a single command shortcut.

Please note that I'm not asking for someone else to implement this, I'm simply asking for feedback so, if I choose to go forward on this myself, I don't end up implementing the wrong solution.

-Kevin Ballard
-- 
Kevin Ballard
http://kevin.sb.org
kevin@sb.org
http://www.tildesoft.com
Brandon Casey· Jan 17, 2008, 17:33 UTC · re: Kevin Ballard · lore

Re: git fetch+rebase on a local tracking branch

On Thu, 17 Jan 2008, Kevin Ballard wrote:
Show 9 quoted lines
> When I'm working on a local tracking branch, is there an easier way to do 
> `git fetch && git rebase origin/branch`? I could imagine either a config 
> value like branch.master.rebase = remotes/origin/master (although it would be 
> nice to avoid duplicating the remote name, since we already have 
> branch.master.remote), or perhaps a --rebase command to git pull such that it 
> simply performs a rebase instead of a merge.
>
> Is there some reason there isn't already a solution like this, or am I simply 
> missing something?
It exists in master.
commit cd67e4d46b122b161f2ad7d943e4ae7aa8df6cf5
Author: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Date:   Wed Nov 28 13:11:07 2007 +0000
     Teach 'git pull' about --rebase
...
-brandon
Kevin Ballard· Jan 17, 2008, 17:44 UTC · re: Brandon Casey · lore

Re: git fetch+rebase on a local tracking branch

On Jan 17, 2008, at 12:33 PM, Brandon Casey wrote:
Show 20 quoted lines
> On Thu, 17 Jan 2008, Kevin Ballard wrote:
>
>> When I'm working on a local tracking branch, is there an easier way  
>> to do `git fetch && git rebase origin/branch`? I could imagine  
>> either a config value like branch.master.rebase = remotes/origin/ 
>> master (although it would be nice to avoid duplicating the remote  
>> name, since we already have branch.master.remote), or perhaps a -- 
>> rebase command to git pull such that it simply performs a rebase  
>> instead of a merge.
>>
>> Is there some reason there isn't already a solution like this, or  
>> am I simply missing something?
>
> It exists in master.
>
> commit cd67e4d46b122b161f2ad7d943e4ae7aa8df6cf5
> Author: Johannes Schindelin <Johannes.Schindelin@gmx.de>
> Date:   Wed Nov 28 13:11:07 2007 +0000
>
>    Teach 'git pull' about --rebase

Excellent. I've been using master, but apparently I forgot to update my manpages. Glad to see this problem's been solved.

Thanks, Kevin Ballard

-- 
Kevin Ballard
http://kevin.sb.org
kevin@sb.org
http://www.tildesoft.com

← back to recent threads