git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: history missing

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Nov 8, 2010, 09:02 UTC
Message-ID
<20101108090230.GC2430@burratino>
In-Reply-To
<AANLkTikFB5HNOmg0iTdjHxtrhU9vdua5O8btgFzpg-2F@mail.gmail.com>
Hi Vitaliy,
Vitaliy Semochkin wrote:
Show 6 quoted lines
> 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

Previous: Sverre RabbelierNext: Martin von Zweigbergk
Message 3 of 10 in “history missing”
  1. Vitaliy SemochkinOct 26, 2010
  2. Sverre RabbelierOct 26, 2010
  3. Jonathan NiederNov 8, 2010
  4. Martin von ZweigbergkNov 8, 2010
  5. Jakub NarebskiNov 8, 2010
  6. Martin von ZweigbergkNov 8, 2010
  7. Jakub NarebskiNov 8, 2010
  8. Martin von ZweigbergkNov 8, 2010
  9. Jeff KingNov 8, 2010
  10. Alex RiesenNov 8, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.