Git: git branch

Source: Internet
Author: User

Git: git branch -- set-upstream


When git creates a new branch locally and pushes it to the remote server, the following prompt will be reported if it is not processed again:


You asked me to pull without telling me which branch youwant to merge with, and 'branch.production.merge' inyour configuration file does not tell me, either. Pleasespecify which branch you want to use on the command line andtry again (e.g. 'git pull <repository> <refspec>').See git-pull(1) for details. If you often merge with the same branch, you may want touse something like the following in your configuration file:     [branch "debug"]    remote = <nickname>    merge = <remote-ref>     [remote "<nickname>"]    url = <url>    fetch = <refspec> See git-config(1) for details.


Problem Analysis:

After creating a local branch in git, you must perform remote branch association. If no association exists, git will prompt you to add the association in the following operations. The purpose of association is to operate on the local branch: git pull and git push. You do not need to specify the remote branch in the command line. after being pushed to a remote branch, you will be prompted when git pull is not displayed.


Solution:

Run git branch -- set-upstream; the instance is as follows, where debug is the branch

git branch --set-upstream debug origin/debug


The final modification of the command is for the config file.

 

Use -- set-upstream to track remote branches.

[core]repositoryformatversion = 0filemode = truebare = truelogallrefupdates = true[remote "origin"]fetch = +refs/heads/*:refs/remotes/origin/*url = git@192.168.1.160:android2.3.5_r1.git[branch "master"]remote = originmerge = refs/heads/master[branch "debug"]remote = originmerge = refs/heads/debug[receive]denyCurrentBranch = ignore

Note the config file in the repository. git directory.




Related Article

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.