Git: Cannot see new remote branch

前端 未结 9 1777
一个人的身影
一个人的身影 2021-01-29 18:55

A colleague pushed a new remote branch to origin/dev/homepage and I cannot see it when I run:

$ git branch -r

I still see preexisting remote br

相关标签:
9条回答
  • 2021-01-29 19:50

    Doing a git remote update will also update the list of branches available from the remote repository.

    If you are using TortoiseGit, as of version 1.8.3.0, you can do "Git -> Sync" and there will be a "Remote Update" button in the lower left of the window that appears. Click that. Then you should be able to do "Git -> Switch/Checkout" and have the new remote branch appear in the dropdown of branches you can select.

    0 讨论(0)
  • 2021-01-29 19:54

    First, double check that the branch has been actually pushed remotely, by using the command git ls-remote origin. If the new branch appears in the output, try and give the command git fetch: it should download the branch references from the remote repository.

    If your remote branch still does not appear, double check (in the ls-remote output) what is the branch name on the remote and, specifically, if it begins with refs/heads/. This is because, by default, the value of remote.<name>.fetch is:

    +refs/heads/*:refs/remotes/origin/*
    

    so that only the remote references whose name starts with refs/heads/ will be mapped locally as remote-tracking references under refs/remotes/origin/ (i.e., they will become remote-tracking branches)

    0 讨论(0)
  • 2021-01-29 19:54

    I used brute force and removed the remote and then added it

    git remote rm <remote>
    git remote add <url or ssh>
    
    0 讨论(0)
提交回复
热议问题