Pull code from GitLab
In actual enterprise development, we often need to use GitLab to host code to facilitate team cooperation and development. Let's take a look at how to pull the project code from GitLab for development.
Install Git
First we need to install Git software on the computer. This software can help us operate the remote Git warehouse, such as submitting and pushing code to the remote warehouse, or pulling and merging the latest code from the remote warehouse.
Download address : https://git-scm.com/
Then just click Next to install without thinking. I always use the default option.
Pull GitLab code
After Git is installed, we can use Git software to pull code from the remote warehouse. The specific steps are as follows:
1. Right-click the mouse where you want to store the code and open the git bash software
Note: Be sure to enter the directory where we want to store the code and open git bash
2. Use the git clone command to download the code
Use the git clone command to pull the code. You can use -b branch name later to specify the code branch to pull. Then you need to specify the address of the warehouse. We generally use the http link address.
git clone [-b develop] http://xxxx.git
After downloading , you can see the project code directory in the directory. Here I specify the develop branch , or you can not specify it. The default branch is downloaded by default.
3. We can also use git branch to view the branch of the current code
But please note that we need to first enter the pulled code directory to operate
If the current branch is not the branch we want, we can also switch the branch of the code through git checkout branch name . After switching, the local code will also be updated to the code of the new branch .
You can check which branches are in the remote warehouse
After determining the branch, you can switch the branch . We can see that the code has changed after the switch.