On a new machine, how do I fetch an existing branch?

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?

Answers


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


Need Your Help

Why is the viewport tag changed in Foundation 5.0? No width=device-width?

zurb-foundation

In Zurb Foundation 4.0, the docs say to include (in a page head):

Perl: infinite loop array?

arrays perl loops

I need an infinite loop into finite array...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.