Git pulls a remote branch and creates a local branch

Source: Internet
Author: User
One, view remote branch

Use the following git command to view all remote branches:

Git branch-r
1 Two, pull remote branch and create local branch Method One

Use the following command:

git checkout-b local branch name x origin/Remote branch name X
1

Using this method creates a new branch x locally and automatically switches to that local branch X.

The local branch established with this method establishes a mapping relationship with the remote branch. Mode two

Use the following command:

Git Fetch Origin Remote branch name x: local branch name X
1

Using this method creates a new branch x locally, but does not automatically switch to that local branch x, which requires manual checkout.

A local branch established using this method does not establish a mapping relationship with the remote branch. third, local branch and remote branch to establish the role of mapping relationship

See blog post git branch upstream

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.