Re: Question about "git pull --rebase"

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: Question about "git pull --rebase"

From: Francis Moreau <hidden>
Date: 2016-06-15 22:47:43

Johan 't Hart [off-list ref] writes:
Francis Moreau schreef:
quoted
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:
quoted
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.
quoted
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..?
Looks like you did :)

I've been somehow confused by the git-pull man page, which says:

  A parameter <ref> without a colon is equivalent to <ref>: when
  pulling/fetching, so it merges <ref> into the current branch without
  storing the remote branch anywhere locally

So I thought that both of the commands were equivalent for 'git pull
--rebase'.

Thanks for the explanation.
-- 
Francis

Re: Question about "git pull --rebase"

From: Johan 't Hart <hidden>
Date: 2016-06-15 22:47:43

Francis Moreau schreef:
Looks like you did :)

I've been somehow confused by the git-pull man page, which says:

  A parameter <ref> without a colon is equivalent to <ref>: when
  pulling/fetching, so it merges <ref> into the current branch without
  storing the remote branch anywhere locally

So I thought that both of the commands were equivalent for 'git pull
--rebase'.

Thanks for the explanation.
Ah that part.

It means that
$ git pull --rebase origin master

means the same as:
$ git pull --rebase origin master:
(note extra colon at the end)

But not as:
$ git pull --rebase origin master:foo

It means that, when you give a refspec without a colon, it is the same 
as the refspec with the colon and without the right side.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help