Git branches: tracking upstream

前端 未结 1 1066
遥遥无期
遥遥无期 2020-12-15 11:45

I don\'t know if im misusing Git, or if I\'ve got a configuration problem, so any clarity would be appreciated :)

I clone my github repos onto machine A and B, then

相关标签:
1条回答
  • 2020-12-15 12:07

    since git config push.default doesn't return anything, that means, with "git 1.8.0.msysgit.0", your git push means git push origin :, with the refspec ':' standing for "matching" branch.

    Here it creates a matching branchA on the remote side.

    But that doesn't make it a remote tracking branch.
    In other word, branch.branchA.merge isn't set to anything.
    This is why the git pull fails: it doesn't know what remote branch it is supposed to merge to local branchA.


    Note, your first git push should have displayed the following message:

    warning: push.default is unset; its implicit value is changing in
    Git 2.0 from 'matching' to 'simple'. To squelch this message
    and maintain the current behavior after the default changes, use:
    
      git config --global push.default matching
    
    To squelch this message and adopt the new behavior now, use:
    
      git config --global push.default simple
    
    See 'git help config' and search for 'push.default' for further information.
    (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
    'current' instead of 'simple' if you sometimes use older versions of Git)
    

    So, with Git2.0, that git push will fail.
    The only way to push branchA will be by setting explicitly its upstream branch (using the same name):

    git push -u origin branchA
    
    0 讨论(0)
提交回复
热议问题