If I clone a repository with max depth of 1 at a tag, it works and pulls down just that. If I then want to do a fetch with or without depth of 1 for a new tag, it does some processing, but the tag never shows up under 'git tag'. If I supply the --tags option, it downloads the whole repository rather than just the new information. I don't mind the repository getting more history, I just want to avoid the download times. Is there any way to get a new tag without getting all tags from a shallow cloned repository?
git clone --branch 1.0 --depth 1 repositoryPath
git fetch --depth 1 origin tags/1.1 # Does processing but no new tags
git fetch --tags origin tags/1.1 # Pulls down the rest of the repository and adds all tags
git fetch --depth 1 --tags origin tags/1.1 # Same as above
Now, I have noticed this in the documentation: "--depth ... Tags for the deepened commits are not fetched."
Is this what I'm running into? Is there no way to do this besides downloading all tags?
You can use the full
<refspec>
format:Or, as specified in git-fetch options (under
<refspec>
):So the short form answer to your question would be