Github - Checkout Someone Else's Branch

I always forget how to do this, so this is just Google fodder.

If I want to checkout a branch from someone else's repository:

git checkout -t -b $local_branch_name $remote_branch_name

The '-t' option says "track the remote branch from my branch". The '-b' option says to actually create the branch with the given name (name will be derived from $remotebranchname if omitted).

It's so simple that I don't know why I forget this, but I do. Now that I've posted this, I probably won't forget it again :)

1 Comment

...or you can use Git GUI :-)

Leave a comment

About Ovid

user-pic Have Perl; Will Travel. Freelance Perl/Testing/Agile consultant. Photo by http://www.circle23.com/. Warning: that site is not safe for work. The photographer is a good friend of mine, though, and it's appropriate to credit his work.