Re: origin/branchname and tracking branch pointing to different commits?

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

Re: origin/branchname and tracking branch pointing to different commits?

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:48:56

Eugene Sajine [off-list ref] writes:
On Thu, Jan 7, 2010 at 8:32 PM, Junio C Hamano [off-list ref] wrote:
quoted
Eugene Sajine [off-list ref] writes:
quoted
$ git fetch origin branchname

are both causing the output like this:

From git://....
* branch      branchname    -> FETCH_HEAD
...

but "git fetch" says:

From git://....
* branch      branchname    -> origin/branchname

Is this inconsistent behavior necessary by design?
It is by design...
I'm coming back to this topic as i see some confusion growing about
such behavior. Every now and then users come across this problem and
they expect pull to *really* behave as fetch and merge so it will
cause the update of remote/branchname branch. And it is kind of
difficult to justify why they have to do git fetch after pull...

Can somebody, please, take a look?


In your transcript, they can say "git fetch" (or "git fetch origin") and
branch is copied to origin/branch, so instead of doing:

    $ git fetch origin branchname
    $ git log FETCH_HEAD ;# or whatever inspection using FETCH_HEAD

they can do

    $ git fetch ;# or git fetch origin
    $ git log origin/branch ;# or whatever inspection using it

In short, teach them that they no longer have reason to learn or run "git
fetch origin branchname".

Re: origin/branchname and tracking branch pointing to different commits?

From: Eugene Sajine <hidden>
Date: 2016-06-15 22:48:56

In your transcript, they can say "git fetch" (or "git fetch origin") and
branch is copied to origin/branch, so instead of doing:

   $ git fetch origin branchname
   $ git log FETCH_HEAD ;# or whatever inspection using FETCH_HEAD

they can do

   $ git fetch ;# or git fetch origin
   $ git log origin/branch ;# or whatever inspection using it

In short, teach them that they no longer have reason to learn or run "git
fetch origin branchname".
Junio,

Yes, that's pretty much what we are doing. we are using "git fetch
origin" to update local remote branches (remote/branch) and then use
the information in there to inspect what are the incoming changes. I
was never teaching anybody to use "git fetch origin branch" So, we are
on the same page here with you.

The confusion though is that "git pull origin master" uses FETCH_HEAD
to store the information about remote master branch instead of
origin/master branch.
Therefore when people are using pull - they get confused why this
branch (origin/master) was not updated. Do you think that FETCH_HEAD
usage for pull still makes sense?

Thanks,
Eugene
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help