2

I follow the instructions on unfuddle exactly and no matter what I only can the master back. Pushing branches works fine, but not fetching.

Does anyone have any advice? Thanks.

Scott
  • 330
  • 3
  • 15
  • have you tried `git checkout -t origin/branch` after fetch? – CharlesB Nov 03 '11 at 16:44
  • thank you very much. That worked! Do you happen to know why this branch does not show when I do a 'git branch'? – Scott Nov 03 '11 at 16:52
  • You're welcome; I've added it as an answer so that you can accept it. the branch wasn't showing because `git branch` lists only local branches. To list also remote ones use `git branch -v` – CharlesB Nov 03 '11 at 17:00

2 Answers2

2

When you fetch a remote, the branches are in your repository, but as remote branches. git branch lists only local branches, so it doesn't appear.

You must make the branch local with git checkout -t origin/mybranch (this will also check it out in your working copy), or git branch mybranch origin/mybranch to create it without checkout.

CharlesB
  • 86,532
  • 28
  • 194
  • 218
0

When you list branches you can do one of 3 things:

git branch

will show the local branches (only one will be created after a clone)

git branch -r

will show you the remote tracking branches. This is what you were interested in.

git branch -a

will show you all the branches (local and remote tracking)

To get a remote tracking branch to be tracked by a local branch,

git checkout -t origin/branchname

You may not need to do this if, for example, you just want to merge a remote branch to your current one.

git merge origin/somebranch

will work just fine.

user229044
  • 232,980
  • 40
  • 330
  • 338
Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141