All of lore.kernel.org
 help / color / mirror / Atom feed
* history missing
@ 2010-10-26 19:47 Vitaliy Semochkin
  2010-10-26 20:04 ` Sverre Rabbelier
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Vitaliy Semochkin @ 2010-10-26 19:47 UTC (permalink / raw)
  To: git

Hi,

I cloned a remote repository
to check recent changes in origin/master I do:
git fetch origin master
git log origin master

recently I found out that log doesn't show recent commits
I know that on server there were several commits let's say on the 19th
but log shows that recent commit was done on the 17th
the most strange thing I'm sure I have seen those commits fetched already
I did git fetch origin master several times but it didn't help
the log says that recent commit was done on 17th
after I performed git remote update
log again shows recent commits on 19th
Has anyone faced such behaviour?
I'm relatively new git user, what do I do wrong?

Thanks in advance,
Vitaliy S

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: history missing
  2010-10-26 19:47 history missing Vitaliy Semochkin
@ 2010-10-26 20:04 ` Sverre Rabbelier
  2010-11-08  9:02 ` Jonathan Nieder
  2010-11-08 11:29 ` Alex Riesen
  2 siblings, 0 replies; 10+ messages in thread
From: Sverre Rabbelier @ 2010-10-26 20:04 UTC (permalink / raw)
  To: Vitaliy Semochkin; +Cc: git

Heya,

On Tue, Oct 26, 2010 at 12:47, Vitaliy Semochkin <vitaliy.se@gmail.com> wrote:
> I cloned a remote repository
> to check recent changes in origin/master I do:
> git fetch origin master
> git log origin master

So, you can either of:

$ git pull origin master # fetches and merges
$ git log origin/master # looks at what upstream has but that you have
not merged yet
$ git rebase origin/master # rebase your changes on top of upstream
$ git merge origin/master # merge with upstream

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: history missing
  2010-10-26 19:47 history missing Vitaliy Semochkin
  2010-10-26 20:04 ` Sverre Rabbelier
@ 2010-11-08  9:02 ` Jonathan Nieder
  2010-11-08 11:56   ` Martin von Zweigbergk
  2010-11-08 11:29 ` Alex Riesen
  2 siblings, 1 reply; 10+ messages in thread
From: Jonathan Nieder @ 2010-11-08  9:02 UTC (permalink / raw)
  To: Vitaliy Semochkin; +Cc: git, Sverre Rabbelier

Hi Vitaliy,

Vitaliy Semochkin wrote:

> I cloned a remote repository
> to check recent changes in origin/master I do:
> git fetch origin master
> git log origin master
> 
> recently I found out that log doesn't show recent commits

Yes, this can be confusing.

The "git fetch" command can be used in two ways: to update
remote-tracking branches and to grab some particular branch (or
other ref) quickly.

Updating remote-tracking branches
---------------------------------

Use "git fetch <remote>", or "git fetch --all" if you want to update
all remote-tracking branches.

Inspecting a particular branch
------------------------------

Use "git fetch <remote> <branch>"; this will fetch that branch and
store it as FETCH_HEAD.  You can "git log FETCH_HEAD", "git merge
FETCH_HEAD", etc, to interact with the branch head you just
downloaded.

If you want to fetch a branch to a local branch, you could use

	git fetch <remote> <branch>
	git branch <local-branch-name> FETCH_HEAD

but there is also a shorter way to write that:

	git fetch <remote> <branch>:<local-branch-name>

This form is especially useful for grabbing a subtree of the branch
hierarchy all at once:

	git fetch junio refs/heads/sg/*:gabor/*

The "git fetch <remote>" form is syntactic sugar for this syntax.  The
'fetch' lines in .git/config describe what remote:local ref specifiers
will be implicitly added to the command line after the name of a
configured remote repository.

See the "git fetch" manual for details and examples.

Hope that helps,
Jonathan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: history missing
  2010-10-26 19:47 history missing Vitaliy Semochkin
  2010-10-26 20:04 ` Sverre Rabbelier
  2010-11-08  9:02 ` Jonathan Nieder
@ 2010-11-08 11:29 ` Alex Riesen
  2 siblings, 0 replies; 10+ messages in thread
From: Alex Riesen @ 2010-11-08 11:29 UTC (permalink / raw)
  To: Vitaliy Semochkin; +Cc: git

On Tue, Oct 26, 2010 at 21:47, Vitaliy Semochkin <vitaliy.se@gmail.com> wrote:
> I cloned a remote repository
> to check recent changes in origin/master I do:
> git fetch origin master
> git log origin master
>
> recently I found out that log doesn't show recent commits

The command "git log origin master" lists all commits
of the branch "origin" affecting the file "master".
Are you sure that is what you want?
Maybe you meant:

  $ git log origin/master # the history of upstream ("origin") branch "master"

or

  $ git log origin/master.. # changes in the active branch not merged
into upstream

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: history missing
  2010-11-08  9:02 ` Jonathan Nieder
@ 2010-11-08 11:56   ` Martin von Zweigbergk
  2010-11-08 13:29     ` Jakub Narebski
  0 siblings, 1 reply; 10+ messages in thread
From: Martin von Zweigbergk @ 2010-11-08 11:56 UTC (permalink / raw)
  To: Jonathan Nieder
  Cc: Vitaliy Semochkin, git, Sverre Rabbelier, Jeff King, Junio C Hamano

On Mon, Nov 8, 2010 at 4:02 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Hi Vitaliy,
>
> Vitaliy Semochkin wrote:
>
>> I cloned a remote repository
>> to check recent changes in origin/master I do:
>> git fetch origin master
>> git log origin master
>>
>> recently I found out that log doesn't show recent commits
>
> Yes, this can be confusing.

I agree and I believe this has come up a lot of times before. I talked
to Jeff and Junio about this at GitTogether and Jeff said he has a patch
for it that he would try to get up to date in a while. (Thanks, Jeff!)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: history missing
  2010-11-08 11:56   ` Martin von Zweigbergk
@ 2010-11-08 13:29     ` Jakub Narebski
  2010-11-08 13:37       ` Martin von Zweigbergk
  0 siblings, 1 reply; 10+ messages in thread
From: Jakub Narebski @ 2010-11-08 13:29 UTC (permalink / raw)
  To: Martin von Zweigbergk
  Cc: Jonathan Nieder, Vitaliy Semochkin, git, Sverre Rabbelier,
	Jeff King, Junio C Hamano

Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> writes:
> On Mon, Nov 8, 2010 at 4:02 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
>> Vitaliy Semochkin wrote:
>>
>>> I cloned a remote repository
>>> to check recent changes in origin/master I do:
>>> git fetch origin master

This fetches into FETCH_HEAD _only_ from "origin" *remote*.

>>> git log origin master

This show log of 'origin/HEAD', which probably is 'origin/master'...
but which didn't get updated, and local branch 'master'.

>>>
>>> recently I found out that log doesn't show recent commits
>>
>> Yes, this can be confusing.
> 
> I agree and I believe this has come up a lot of times before. I talked
> to Jeff and Junio about this at GitTogether and Jeff said he has a patch
> for it that he would try to get up to date in a while. (Thanks, Jeff!)

How can this issue be solved?  The meaning of parameters in 'git fetch'
is different from meaning of parameters in 'git log'.

Unless it is about adding hint / advice for when doing 
'git fetch <remote> <branch>'...

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: history missing
  2010-11-08 13:29     ` Jakub Narebski
@ 2010-11-08 13:37       ` Martin von Zweigbergk
  2010-11-08 13:48         ` Jakub Narebski
  0 siblings, 1 reply; 10+ messages in thread
From: Martin von Zweigbergk @ 2010-11-08 13:37 UTC (permalink / raw)
  To: Jakub Narebski
  Cc: Jonathan Nieder, Vitaliy Semochkin, git, Sverre Rabbelier,
	Jeff King, Junio C Hamano

On Mon, Nov 8, 2010 at 8:29 AM, Jakub Narebski <jnareb@gmail.com> wrote:
> Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> writes:
>> On Mon, Nov 8, 2010 at 4:02 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
>>> Vitaliy Semochkin wrote:
>>>
>>>> I cloned a remote repository
>>>> to check recent changes in origin/master I do:
>>>> git fetch origin master
>
> This fetches into FETCH_HEAD _only_ from "origin" *remote*.
>
>>>> git log origin master
>
> This show log of 'origin/HEAD', which probably is 'origin/master'...
> but which didn't get updated, and local branch 'master'.
>
>>>>
>>>> recently I found out that log doesn't show recent commits
>>>
>>> Yes, this can be confusing.
>>
>> I agree and I believe this has come up a lot of times before. I talked
>> to Jeff and Junio about this at GitTogether and Jeff said he has a patch
>> for it that he would try to get up to date in a while. (Thanks, Jeff!)
>
> How can this issue be solved?  The meaning of parameters in 'git fetch'
> is different from meaning of parameters in 'git log'.
>

Sorry, maybe I misunderstood what the confusion was about. What I was
referring to was the confusion caused by 'git fetch origin master' not
updating 'refs/remotes/origin/master'.

/Martin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: history missing
  2010-11-08 13:37       ` Martin von Zweigbergk
@ 2010-11-08 13:48         ` Jakub Narebski
  2010-11-08 14:14           ` Martin von Zweigbergk
  0 siblings, 1 reply; 10+ messages in thread
From: Jakub Narebski @ 2010-11-08 13:48 UTC (permalink / raw)
  To: Martin von Zweigbergk
  Cc: Jonathan Nieder, Vitaliy Semochkin, git, Sverre Rabbelier,
	Jeff King, Junio C Hamano

On Mon, 8 Nov 2010, Martin von Zweigbergk wrote:
> On Mon, Nov 8, 2010 at 8:29 AM, Jakub Narebski <jnareb@gmail.com> wrote:
>> Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> writes:
>>> On Mon, Nov 8, 2010 at 4:02 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
>>>> Vitaliy Semochkin wrote:
>>>>
>>>>> I cloned a remote repository
>>>>> to check recent changes in origin/master I do:
>>>>> git fetch origin master
>>
>> This fetches into FETCH_HEAD _only_ from "origin" *remote*.
>>
>>>>> git log origin master
>>
>> This show log of 'origin/HEAD', which probably is 'origin/master'...
>> but which didn't get updated, and local branch 'master'.
>>
>>>>>
>>>>> recently I found out that log doesn't show recent commits
>>>>
>>>> Yes, this can be confusing.
>>>
>>> I agree and I believe this has come up a lot of times before. I talked
>>> to Jeff and Junio about this at GitTogether and Jeff said he has a patch
>>> for it that he would try to get up to date in a while. (Thanks, Jeff!)
>>
>> How can this issue be solved?  The meaning of parameters in 'git fetch'
>> is different from meaning of parameters in 'git log'.
> 
> Sorry, maybe I misunderstood what the confusion was about. What I was
> referring to was the confusion caused by 'git fetch origin master' not
> updating 'refs/remotes/origin/master'.

Should it really do it?  What if it does not exist?  What if <remote>
is specified via URL?

If I understand correctly current behavior of 'git fetch <remote> <branch>'
wrt. FETCH_HEAD was meant for one-off 'git pull <remote> <branch>', or
rather 'git pull <URL> <branch>'.

Sidenote: if original poster used

  $ git fetch origin
  $ git log origin

I think everything would be all right.

-- 
Jakub Narebski
Poland

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: history missing
  2010-11-08 13:48         ` Jakub Narebski
@ 2010-11-08 14:14           ` Martin von Zweigbergk
  2010-11-08 18:28             ` Jeff King
  0 siblings, 1 reply; 10+ messages in thread
From: Martin von Zweigbergk @ 2010-11-08 14:14 UTC (permalink / raw)
  To: Jakub Narebski
  Cc: Jonathan Nieder, Vitaliy Semochkin, git, Sverre Rabbelier,
	Jeff King, Junio C Hamano

On Mon, Nov 8, 2010 at 8:48 AM, Jakub Narebski <jnareb@gmail.com> wrote:
> On Mon, 8 Nov 2010, Martin von Zweigbergk wrote:
>> Sorry, maybe I misunderstood what the confusion was about. What I was
>> referring to was the confusion caused by 'git fetch origin master' not
>> updating 'refs/remotes/origin/master'.
>
> Should it really do it?  What if it does not exist?  What if <remote>
> is specified via URL?

I would probably not expect it to be updated (even if the URL matches a
configured remove). If the reference does not yet exist, I think I would
expect it to be created.

> If I understand correctly current behavior of 'git fetch <remote> <branch>'
> wrt. FETCH_HEAD was meant for one-off 'git pull <remote> <branch>', or
> rather 'git pull <URL> <branch>'.

Also see http://thread.gmane.org/gmane.comp.version-control.git/127163/.
Junio, Jeff and Avery can argue much better for and against this than I
can. I read it at some point, but I don't quite remember now if they did
discuss the historical reasons for the current behavior in that thread.

/Martin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: history missing
  2010-11-08 14:14           ` Martin von Zweigbergk
@ 2010-11-08 18:28             ` Jeff King
  0 siblings, 0 replies; 10+ messages in thread
From: Jeff King @ 2010-11-08 18:28 UTC (permalink / raw)
  To: Martin von Zweigbergk, Junio C Hamano
  Cc: Jakub Narebski, Jonathan Nieder, Vitaliy Semochkin, git,
	Sverre Rabbelier

On Mon, Nov 08, 2010 at 09:14:27AM -0500, Martin von Zweigbergk wrote:

> On Mon, Nov 8, 2010 at 8:48 AM, Jakub Narebski <jnareb@gmail.com> wrote:
> > On Mon, 8 Nov 2010, Martin von Zweigbergk wrote:
> >> Sorry, maybe I misunderstood what the confusion was about. What I was
> >> referring to was the confusion caused by 'git fetch origin master' not
> >> updating 'refs/remotes/origin/master'.
> >
> > Should it really do it?  What if it does not exist?  What if <remote>
> > is specified via URL?
> 
> I would probably not expect it to be updated (even if the URL matches a
> configured remove). If the reference does not yet exist, I think I would
> expect it to be created.

Yeah, the patch I posted a while back (and referenced below) does not
convert URLs into remote names (nor do I think it should). But if you
give it the name of a configured remote, and it is fetching a ref from
the remote that is mentioned on the LHS of a configured fetch refspec,
it will update the matching RHS of that refspec opportunistically.

So it should be pretty unsurprising to the user (see the thread below
for some discussion of when it could be surprising).

> Also see http://thread.gmane.org/gmane.comp.version-control.git/127163/.
> Junio, Jeff and Avery can argue much better for and against this than I
> can. I read it at some point, but I don't quite remember now if they did
> discuss the historical reasons for the current behavior in that thread.

I took a look at cleaning up the patch from that thread. It causes 4 of
the test scripts to fail. Most disturbing is this one:

  $ grep explicit.fetch t/t5510-fetch.sh
  test_expect_success 'explicit fetch should not update tracking' '

which checks for the direct opposite of the behavior we are discussing.
The test was added by Junio in late 2007. However, I can't seem to find
any discussion on the mailing list about it. Junio, do you remember
anything about this?

-Peff

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-11-08 18:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-26 19:47 history missing Vitaliy Semochkin
2010-10-26 20:04 ` Sverre Rabbelier
2010-11-08  9:02 ` Jonathan Nieder
2010-11-08 11:56   ` Martin von Zweigbergk
2010-11-08 13:29     ` Jakub Narebski
2010-11-08 13:37       ` Martin von Zweigbergk
2010-11-08 13:48         ` Jakub Narebski
2010-11-08 14:14           ` Martin von Zweigbergk
2010-11-08 18:28             ` Jeff King
2010-11-08 11:29 ` Alex Riesen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.