Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

How do I shallow clone a git repository, so that my clone contains only 1 history item, and starts on a specific branch?

I know how to do a shallow clone:

git clone --depth 1 https://path/to/myrepo.git

but not start the clone on a specific branch.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
867 views
Welcome To Ask or Share your Answers For Others

1 Answer

To clone repo foo.git with branch bar do:

git clone --depth 1 https://path/to/repo/foo.git -b bar

See the git-clone documentation: https://www.kernel.org/pub/software/scm/git/docs/git-clone.html


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...