我在运行Git的服务器上建立了一个存储库,该存储库具有连接到它的权威/裸存储库。如果然后我在开发计算机上使用以下命令设置存储库的本地版本:

git clone //ip-address/projectfolder/project.git

我可以查看所有代码,没有任何问题。

但是,当我使用git checkout -b v1_0_2_1在Git服务器上创建分支时,在开发机器上看不到新分支。我试过运行git remote update当我键入git branch -a时,我只能看到:
* master
  remote/origin/HEAD -> origin/master
  remotes/origin/master

我要去哪里错了?

最佳答案

尝试

git fetch origin

这将从远程仓库中获取所有分支并将其存储在remotes/origin/branchname下

例子 :
ptimac:pfus pti$ git fetch origin
remote: Counting objects: 2283, done.
remote: Compressing objects: 100% (892/892), done.
remote: Total 2009 (delta 990), reused 1698 (delta 688)
Receiving objects: 100% (2009/2009), 297.21 KiB | 256 KiB/s, done.
Resolving deltas: 100% (990/990), completed with 152 local objects.
From github.com:melexis/pfus
   d989914..c09b843  PFUS-682   -> origin/PFUS-682
 * [new branch]      PFUS-686   -> origin/PFUS-686
   b3d0fd2..33e5dd6  PFUS-688   -> origin/PFUS-688
   9765ff2..afe0103  PFUS-697   -> origin/PFUS-697
 * [new branch]      PFUS-699   -> origin/PFUS-699
 * [new branch]      PFUS-700   -> origin/PFUS-700
 * [new branch]      PFUS-768   -> origin/PFUS-768
 * [new branch]      PFUS-769   -> origin/PFUS-769
 * [new branch]      PFUS-770   -> origin/PFUS-770
 * [new branch]      PFUS-771   -> origin/PFUS-771
 * [new branch]      PFUS-773   -> origin/PFUS-773
 * [new branch]      UAT-PATCH  -> origin/UAT-PATCH
   004d135..bc210a6  master     -> origin/master

在这里,我从队友那里得到了新作品,每个人都在各自的分支机构工作,相当于一张票。
ptimac:pfus pti$ git branch -a
  PROD
* UAT
  UAT_V1
  master
  remotes/origin/AUDIT
  remotes/origin/CUKES
  remotes/origin/CUKES_RUBY
  remotes/origin/FIX_AUDIT
  remotes/origin/HEAD -> origin/master
  remotes/origin/INKLESS-423
... many lines snipped ...

这是本地仓库中的分支。

关于git - 为什么我不能远程查看分支,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6253041/

10-13 08:36
查看更多