简体   繁体   中英

Is there a way to clone a tag of a specific git branch?

I want to clone a specific tag with specific branch from github. For example, there is a branch called build and I wanna clone from the branch build the specific tag v1.0.0 . Is that possible with git ?

I know I can clone either the tag or the branch by using something like:

$ git clone --branch v1.0.0 -build https://github.com/somerepro/app --single-branch --depth 1

But I would like to specify something like --branch build --tag v1.0.0 . Is that possible?

There cannot be two tags with the same name in one repo. It doesn't matter if the tag is on a branch or master.

Try checking out the branch then reset HEAD to the tag

git clone --branch build  https://github.com/somerepro/app --single-branch --depth 1
git reset --hard HEAD v1.0.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM