Clone remote Branch to Local on Gitlab

Source: Internet
Author: User
Tags config git clone

First of all, explain the reason: these days in testing their own written interface, the company's project is the form of back-and-forth separation, so I want to clone the front-end code to local, with my local database to test.

However, I found that Gitlab was the three branches under the project, one of which was the front-end code, which knocked me out ...

So again through the network search, and finally a little bit of harvest, in order to prevent later forgotten, just write this text ...

First make sure your PC has a GIT environment installed, and I'm using a git environment under Windows.

Double-click the desktop icon of Git Bash to open the window


Modify Configuration

git config--global user.name

git config--global user.email

Such as:

git config--global user.name "Yang"

git config--global user.email "yang@XX.com"

See my operation:


Go to the directory where you want to put the project, the Git_out directory in the example is the directory where I put the project

Cloning a remote project git clone

such as: Git clone http://XXX.XXX/sq-group/XXX.git

After cloning is complete, you can see the project name, and after entering the project, you can see some git related files




Enter the project (that is, the folder in which the. git is located)

viewing remote branches

Git branch-r

Such as:


Establish local Correspondence Branch

git checkout--track or git checkout-b

Such as:

git checkout--track Origin/yang



after the establishment of the points, the default will be entered into the new branch, if you want to go to other branches, you can use git checkout plus branch name Switch

such as:

git checkout Ouyaya



Well, that's basically all done.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.