如何使用 git worktree 检出现有的远程分支 - 不在本地引用中
How do I checkout existing remote branch with git worktree - Not in local refs
我在 github 上有一个分支 feature/issue/xyz,当我尝试通过 git-worktee 结账时,它一直告诉我不存在
hint:
hint: If you are planning on basing your work on an upstream
hint: branch that already exists at the remote, you may need to
hint: run "git fetch" to retrieve it.
hint:
hint: If you are planning to push out a new local branch that
hint: will track its remote counterpart, you may want to use
hint: "git push -u" to set the upstream config as you push.
我知道它存在,已在 github 和本地非工作树克隆中验证机器人
我试过了 :
git worktree add --track -b feature/issue/xyz feature/issue/xyz origin/feature/issue/xyz
git worktree add --track -b feature/issue/xyz feature/issue/xyz origin/feature/issue/xyz
和
git worktree add --track -b feature/issue/xyz feature/issue/xyz refs/heads/feature/issue/xyz
我已经尝试 git 抓取,但我只看到
* branch HEAD -> FETCH_HEAD
我再次尝试添加后仍然得到相同的结果
我通过以下方式解决了这个问题:
git fetch origin 'refs/heads/*:refs/heads/*'
然后简单地添加 git worktree add feature/issue/xyz feature/issue/xyz
这拉到了正确的分支
我在 github 上有一个分支 feature/issue/xyz,当我尝试通过 git-worktee 结账时,它一直告诉我不存在
hint:
hint: If you are planning on basing your work on an upstream
hint: branch that already exists at the remote, you may need to
hint: run "git fetch" to retrieve it.
hint:
hint: If you are planning to push out a new local branch that
hint: will track its remote counterpart, you may want to use
hint: "git push -u" to set the upstream config as you push.
我知道它存在,已在 github 和本地非工作树克隆中验证机器人
我试过了 :
git worktree add --track -b feature/issue/xyz feature/issue/xyz origin/feature/issue/xyz
git worktree add --track -b feature/issue/xyz feature/issue/xyz origin/feature/issue/xyz
和
git worktree add --track -b feature/issue/xyz feature/issue/xyz refs/heads/feature/issue/xyz
我已经尝试 git 抓取,但我只看到
* branch HEAD -> FETCH_HEAD
我再次尝试添加后仍然得到相同的结果
我通过以下方式解决了这个问题:
git fetch origin 'refs/heads/*:refs/heads/*'
然后简单地添加 git worktree add feature/issue/xyz feature/issue/xyz
这拉到了正确的分支