Pull code from GitLab

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/

image-20230718152101292

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

image-20230718152612865

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

image-20230718153255511

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.

image-20230718154921676

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

image-20230718153901730

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

image-20230718154410652

After determining the branch, you can switch the branch . We can see that the code has changed after the switch.

image-20230718154100686

Supongo que te gusta

Origin blog.csdn.net/weixin_41405524/article/details/131789425
Recomendado
Clasificación