git pulls the specified branch code
1. Use the git clone command to clone the entire repository
Then use the git checkout command to switch to the specified branch:
git clone <Warehouse address> cd <Warehouse Directory> git checkout <Branch name>
This method is suitable for cases where only the specified branch code needs to be pulled.
2. When using the git clone command
Specify the branch to be pulled with the -b parameter:
git clone -b <Branch name> <Warehouse address>
This method will directly clone the code of the specified branch without manually switching branches.
3. First use the git init command to create an empty local repository
Then add the remote repository through the git remote add command
Finally, use the git pull command to pull the code for the specified branch:
git init git remote add origin <Remote warehouse address> git fetch git checkout <Branch name>
This method is suitable for situations where an empty local repository already exists and then pulling the code for the specified branch.
Summarize
The above is personal experience. I hope you can give you a reference and I hope you can support me more.