[Git] Associates a local branch with a remote branch

Source: Internet
Author: User

.

.

.

.

.

Adding Git to your local project and associating it with a remote, empty library takes just a few steps.

1. Create an empty library

inch d:/workspace/shop/.git/

2. Add a remote repository

ssh://[email protected]:29418/prj/shop

3. Get the branch in the warehouse

$ git fetchremote:counting objects:2, Doneremote:finding Sources: -% (2/2) Remote:total2(Delta0), reused0(Delta0) Unpacking objects: -% (2/2), Done. fromSSH://192.168.1.2:29418/prj/shop* [New branch] master, origin/master$ git branch-a remotes/origin/master

4. Create a local branch

ssh://192.168.1.2:29418/prj/shop * Branch            Master     --A * Master  remotes/origin/master

5. Associating a local branch with a remote branch

$ git Branch--set-upstream-to=origin/'master'  'origin'.

Complete.

After the above steps, the operation of this branch is the same as the branch that was obtained directly from Git clone.

[Git] Associates a local branch with a remote branch

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.