Sometimes you just want to clone a separate branch from the repository (for example, the code published by the Web site), and other related branches do not need to be checked out.
It is not appropriate to use GIT to clone the entire version library directly. Search for a bit, found that the need for a lot of stackoverflow on a number of relevant answers:
How to clones a single branch in Git?
In this question, the answer to the most acceptable is this:
git clone <url>--branch <branch>--single-branch [<folder>]
But this answer is slightly different from my actual situation, my code was previously managed with SVN, on the server has been published using the SVN method, using this command prompted the error:
Git clone-b qinghaihu--single-branch.
Because the current directory already has a corresponding file, if published to a new directory is not the problem.
Find the answer from another question:
Clone a specific Git branch [duplicate]
That
CD $BRANCH
Git init
git remote add-t $BRANCH-F Origin $REMOTE _repo
Git checkout-f $BRANCH
Note that the last checkout command adds a-f argument so that you can force overwriting an existing file