Re: Question about "git pull --rebase"

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Johan 't Hart
Date: Saturday, November 14, 2009 - 4:29 pm

Francis Moreau schreef:
 > hello,
 >
 > Let's say I'm on a branch called 'foo'.
 >
 > I tried to rebase this branch by using 'git pull --rebase'.
 >
 > I first tried the following command:
 >
 >     $ git pull --rebase origin master:foo
 >     remote: Counting objects: 5, done.
 >     remote: Total 3 (delta 0), reused 0 (delta 0)
 >     Unpacking objects: 100% (3/3), done.
 >     From /dev/shm/git/A
 >     ! [rejected]        master     -> foo  (non fast forward)

When using a refspec, you usually mean to update a remote tracking 
branch, like refs/remotes/origin/master. Internally the refspec 
parameter is passed to git fetch, which fast-forwards your local 
tracking branch to match the remote branch.

With this command, you make git clear you want to fast-forward your 
branch refs/foo to match the remotes master branch, and then rebase your 
  current branch on that foo branch.

Foo probably is also your current branch. So what you probably want is 
to fetch the remotes master branch and rebase your current branch foo on 
it. You could do it this way:

 > Then I tried:
 >
 >     $ git pull --rebase origin master
 >
 > which worked.

This does not update any remote tracking branches, but it will rebase 
your foo branch on the remote master branch (which is what you want)
It could also be done with:

git pull --rebase origin master:origin/master

This will also update your remote tracking branch 
refs/remotes/origin/master to match the master branch on the remote 
repo. Your foo branch will then be rebased onto it.

 >
 > Reading the man git-pull I would assume the 2 commands are equivalent
 > but obviously they're not.
 >
 > So the question is: why ?

So, thats why :) They're not the same. Many words... Hope you 
understand... I hope I understood it well too..?

 >
 > Thanks

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Question about "git pull --rebase", Francis Moreau, (Sat Nov 14, 1:39 pm)
Re: Question about "git pull --rebase", Nanako Shiraishi, (Sat Nov 14, 4:16 pm)
Re: Question about "git pull --rebase", Johan 't Hart, (Sat Nov 14, 4:29 pm)
Re: Question about "git pull --rebase", Francis Moreau, (Sun Nov 15, 7:31 am)
Re: Question about "git pull --rebase", Francis Moreau, (Sun Nov 15, 7:34 am)
Re: Question about "git pull --rebase", Johan 't Hart, (Sun Nov 15, 12:47 pm)
Re: Question about "git pull --rebase", Junio C Hamano, (Sun Nov 15, 1:18 pm)
Re: Question about "git pull --rebase", Johan 't Hart, (Sun Nov 15, 1:32 pm)
Re: Question about "git pull --rebase", Francis Moreau, (Mon Nov 16, 5:00 am)
Re: Question about "git pull --rebase", Francis Moreau, (Mon Nov 16, 5:17 am)