Git fetch remote Branch

Source: Internet
Author: User

If you want to fetch a branch on GitHub to the local machine, directly enter the following command:

Git checkout origin/

Result error:

Error: pathspec 'origin/feature_renrendai_tongji 'did not match any file (s) known to git.

See http://stackoverflow.com/questions/5989592/git-cannot-checkout-branch-error-pathspec-did-not-match-any-files-kn,

The following methods are available:

Execute git fetch to retrieve new information from GitHub and store it in a local repository. For example, the Branch I want to fetch does not have this information locally, execute git branch-A and find that there is no branch. After git fetch is executed,

Then execute

Git checkout-B A origin/

The remote a is retrieved and switched to the local a branch.

However, it seems that the following command can retrieve the information on the server, create branch a, and retrieve branch a on the server:

Git checkout-T-B A origin/

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.