threads / discuss / 1107

git-fetch-pack

Subject: git-fetch-pack

## tl;dr

One message between Jul 5, 2005 and Jul 5, 2005.

replies: 0people: 1as markdown or json

Linus Torvalds· Jul 5, 2005, 00:08 UTC · lore
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

← back to recent threads