开发者

Why can't I view branches remotely

I have a repository set up on a server running Git, the repository has an authoritive / bare repository connected to it. If I then set up a local version of the repository on my development machine with:

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

I can view all of the code without any problems.

However, when I create a branch on the Git server with git checkout -b v1_0_2_1 I can't see the new branch on my development machine. I've tried running git remote update and when I type git branch -a I can only see:

* master
  remote/origin/HEAD -> origin/master
  remotes/origin/master

Where am开发者_如何学JAVA I going wrong?


Try

git fetch origin

This will get all branches from the remote repo and store them under remotes/origin/branchname

example :

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

Here I got the new work from my team mates, each works on their own branch, which corresponds to a ticket.

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 ...

And here are the branches in the local repo.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜