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

git-fetch-pack

From
Linus Torvalds <torvalds@osdl.org>
Date
Jul 5, 2005, 00:08 UTC
Message-ID
<Pine.LNX.4.58.0507041702590.3570@g5.osdl.org>
Ok,
 I've written a "git-fetch-pack" along the lines I outlined a few days 
ago, ie the person doing the fetching ends up listing the commits it has, 
and then both ends negotiate the missing objects.

It's probably buggy in many ways, but I actually used it to fetch the last merge with Russell King:

	remote=$(git-fetch-pack $repo master)
	if [ "$remote" ]; then
		git resolve $(git-rev-parse HEAD) $remote "Merge $repo"
	fi
ends up doing something sane.

In general, the format is to tell git-fetch-pack where to fetch things from, and what branch to use (if you give none, or you give multiple, it does various magic things, you shouldn't do it). It will then fetch and unpack the pack, and return the SHA1 corresponding to the remote ref if everything was successful.

So the above will fetch a remote ref, and resolve it (ie it's basically a specialized "git pull").

		Linus
Message 1 of 1 in “git-fetch-pack”
  1. Linus TorvaldsJul 5, 2005

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.