Re: Cloning a remote tag without using git-fetch-pack directly?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Some quick additional thoughts.

Jeff King wrote:

> To clone a subset of a repository, you have to do the init+fetch trick,
> as you did above.  If you want the configuration set up by clone, you
> can do that, too, with "git config". So the equivalent commands to the
> clone you want are:
>
>   git init linux-2.6
>   cd linux-2.6
>   git config remote.origin.url /home/josh/src/linux-2.6
>   git config remote.origin.fetch refs/tags/v2.6.12
>   git fetch origin

Someone fetching v2.6.12 to build on it today is probably not planning
to run "git fetch origin" to fetch the same tag tomorrow.  So

	git init linux-2.6
	cd linux-2.6
	git remote add origin ~/src/linux-2.6
	git fetch origin refs/tags/v2.6.12

or even "...; git fetch ~/src/linux-2.6 refs/tags/v2.6.12" could be
closer to what is needed.

If for some reason you do want to track how the remote v2.6.12 tag
evolves, "git remote" has a funny way to do that:

	git remote add --mirror=fetch -ttags/v2.6.12 origin ~/src/linux.2.6

The documentation calls the argument to -t "<branch>", but in mirror
mode it is actually a refspec relative to refs/.

With luck (depending on what you are looking to do),
git-new-workdir[1] or "git archive --remote" could also be helpful.

Regards,
Jonathan

[1] with the usual avoidable caveats described at
https://git.wiki.kernel.org/index.php/SoC2011Ideas#Multiple_work_trees
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]