“Cannot update paths and switch to branch at the same time”

前端 未结 11 1677
广开言路
广开言路 2020-12-02 04:24

I sometimes use the checkout -b option to create a new branch, check it out at the same time and set up tracking in one command.

In a new environment, I

相关标签:
11条回答
  • 2020-12-02 05:00

    This simple thing worked for me!

    If it says it can't do 2 things at same time, separate them.

    git branch branch_name origin/branch_name 
    
    git checkout branch_name
    
    0 讨论(0)
  • 2020-12-02 05:00

    First you need to Fetch the remote (the specific branch), then you can create a local br and track it with that remote branch using your command (i.e. checkout with -b and --track).

    0 讨论(0)
  • 2020-12-02 05:02

    For me I needed to add the remote:

    git remote -add myRemoteName('origin' in your case) remoteGitURL
    

    then I could fetch

    git fetch myRemoteName
    
    0 讨论(0)
  • 2020-12-02 05:09

    If you got white space in your branch then you will get this error.

    0 讨论(0)
  • 2020-12-02 05:13

    FWIW: If you have a typo in your branchname you'll get this same error.

    0 讨论(0)
  • 2020-12-02 05:14

    It causes by that your local branch doesn't track remote branch. As ssasi said,you need use these commands:

    git remote update
    git fetch
    git checkout -b branch_nameA origin/branch_nameB
    

    I solved my problem just now....

    0 讨论(0)
提交回复
热议问题