git clone Specifies branch operations

Source: Internet
Author: User
Tags git clone

Recent server migration, and the original local development is to switch between different branches in the same directory, feel a bit frustrated, so you want a file directory to a branch, so there is not too much file differences.

This operation is recorded and may be used later.

This is generally the case with git initialization.

Git init

git clone. Git address

Then the focus comes, because clone down is generally the master branch, which is probably not the branch you want to pull down. You can use the following methods

Git branch-a See the current remote branch first

git checkout origin/xxx select remote XXX Branch

Git branch xxx create local XXX branch

git checkout xxx To select the newly created branch.

---------------

There are, of course, simpler ways.

You can specify a branch of clone directly:

git clone-b xxx. Git address


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.