1

I'm not new to git, but I'm not a gitmaster.

I have an existing branch on my git account, that I would like to pull, but when I do this :

git checkout previously_created_branch

I get..

error: pathspec 'previously_created_branch' did not match any file(s) known to git.

Anyone know how to accomplish this?

Trip
  • 26,756
  • 46
  • 158
  • 277
  • http://stackoverflow.com/questions/1778088/how-to-clone-a-single-branch-in-git would help – VonC Dec 02 '10 at 12:52

3 Answers3

5

Git must know from where you want to get the branch

First fetch the changes from your remote repository:

git fetch origin

Then you can check it out with

git checkout -t origin/previously_created_branch

This will create a local branch of the same name, that tracks the remote branch

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

git checkout branch-name is used to switch branches.

To pull, you should use: git pull origin branch-name, assuming that your remote is named origin.

Alan Haggai Alavi
  • 72,802
  • 19
  • 102
  • 127
  • Yah it didn't work. I get the error I wrote above. If I do git-pull, it says, everything-up-to-date , even though I know for a fact it is not. – Trip Dec 02 '10 at 12:54
0

Maybe you're not tracking the remote branch on the new machine?

To see the list of remote branches:

git branch -r

To track the branch locally (if it isn't already):

git branch --track previously_created_branch origin/previously_created_branch
hallidave
  • 9,579
  • 6
  • 31
  • 27