Re: [PATCH] clone: add a --no-tags option to clone without tags
On 04/18, Ævar Arnfjörð Bjarmason wrote:
Show 49 quoted lines
> Add a --no-tags option to "git clone" to clone without tags. Currently
> there's no easy way to clone a repository and end up with just a
> "master" branch via --single-branch, or track all branches and no
> tags. Now --no-tags can be added to "git clone" with or without
> --single-branch to clone a repository without tags.
>
> Before this the only way of doing this was either by manually tweaking
> the config in a fresh repository:
>
> git init git &&
> cat >git/.git/config <<EOF &&
> [remote "origin"]
> url = git@github.com:git/git.git
> tagOpt = --no-tags
> fetch = +refs/heads/master:refs/remotes/origin/master
> [branch "master"]
> remote = origin
> merge = refs/heads/master
> EOF
> cd git &&
> git pull
>
> Which requires hardcoding the "master" name, which may not be the same
> branch, or alternatively by setting tagOpt=--no-tags right after
> cloning & deleting any existing tags:
>
> git clone --single-branch git@github.com:git/git.git &&
> cd git &&
> git config remote.origin.tagOpt --no-tags &&
> git tag -l | xargs git tag -d
>
> Which of course was also subtly buggy if --branch was pointed at a
> tag, leaving the user in a detached head:
>
> git clone --single-branch --branch v2.12.0 git@github.com:git/git.git &&
> cd git &&
> git config remote.origin.tagOpt --no-tags &&
> git tag -l | xargs git tag -d
>
> Now all this complexity becomes the much simpler:
>
> git clone --single-branch --no-tags git@github.com:git/git.git
>
> Or in the case of cloning a single tag "branch":
>
> git clone --single-branch --branch v2.12.0 --no-tags git@github.com:git/git.git
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
--
Brandon Williams