我在运行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
我哪里错了?
答案 0 :(得分:14)
尝试
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 ...
以下是本地回购中的分支。