For checking out only a given tag for deployment, I use e.g.:
git clone -b 'v2.0' --single-branch --depth 1 https://github.com/git/git.git
This seems to be the fastest way to check out code from a remote repository if one has only interest in the most recent code instead of in a complete repository. In this way, it resembles the 'svn co' command.
Note: Per the Git manual, passing the --depth
flag implies --single-branch
by default.
--depth
Create a shallow clone with a history truncated to the specified number of commits. Implies --single-branch unless --no-single-branch is given to fetch the histories near the tips of all branches. If you want to clone submodules shallowly, also pass --shallow-submodules.