With Git 2.13.x / 2.14 (Q2 2017) this will be possible (i.e. a clone without tags)
clone : add --no-tags option to clone without tags
Add the --no-tags option to clone without retrieving any tags.
Without this change, there is no easy way to clone a repository without also retrieving its tags.
When --single-branch supplied, the main remote branch will be cloned, but tags will also be executed and retrieved.
Now --no-tags you can add --single-branch to clone a repository without a tag and which only tracks one branch upstream.
This option works without --single-branch , and will make a normal clone but not retrieve tags.
Many Git teams pay some fixed overhead depending on the number of links. For instance. creating ~ 40k tags in linux.git will cause the command, for example, git log -1 >/dev/null , to work in a second, and not in milliseconds, in addition, many other things will slow down, for example. " git log <TAB> " with the completion of bash will slowly show ~ 40k links instead of 1.
The user may want to avoid all this overhead by simply using a repository like this to view the master branch, or something like a CI tool, might want to keep this branch up to date without worrying about any other links .
Without this change, the only way to achieve this was to either manually configure the configuration in the new 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
This requires hard coding of the name " master ", which cannot be the main --single-branch , or, alternatively, by setting tagOpt=--no-tags immediately after cloning and removing 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 to a tag, leaving the user in a separate 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 much easier:
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