Why does git branch -t fail with “Not tracking: ambiguous information”?

后端 未结 5 1853
面向向阳花
面向向阳花 2021-02-03 21:10

When I try to create a new branch tracking a remote branch, I get this:

$ git branch -t test origin/foo
error: Not tracking: ambiguous information for ref refs/r         


        
5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-03 21:39

    I got in a situation like this, but I do not know how. The listing from git branch -av showed me only a single remote tracking branch for the branch I cared about (origin/dev).

    What I did to fix it was to use the hexadecimal commit hash instead of origin/dev:

    git checkout -b dev abc123
    git push -u origin dev
    

    When I did the push with -u Git said Branch dev set up to track remote branch dev from origin. Subsequent pulls and pushes worked as I expected.

提交回复
热议问题