How to specify remote branch correctly

2012-12-16 Thread Woody Wu
Hi, List I have two branches in the remote, say, origin/master, origin/foo. Then when I tried to switch to the remote foo branch, the following two methods gave me different results: 1. git checkout foo 2. git checkout origin/foo The first method run silently with success, but the second

Re: How to specify remote branch correctly

2012-12-16 Thread Andrew Ardill
On 17 December 2012 13:30, Woody Wu narkewo...@gmail.com wrote: 1. git checkout foo 2. git checkout origin/foo The first method run silently with success, but the second method complains that I got a 'detached HEAD'. So, I think I don't understand the difference between 'foo' and

Re: How to specify remote branch correctly

2012-12-16 Thread Woody Wu
On 2012-12-17, Andrew Ardill andrew.ard...@gmail.com wrote: On 17 December 2012 13:30, Woody Wu narkewo...@gmail.com wrote: 1. git checkout foo 2. git checkout origin/foo The first method run silently with success, but the second method complains that I got a 'detached HEAD'. So, I think I

Re: How to specify remote branch correctly

2012-12-16 Thread Andrew Ardill
On 17 December 2012 16:06, Woody Wu narkewo...@gmail.com wrote: 1. git checkout foo. By this command, I think I am checking out files in my local branch named foo, and after that I also switch to the branch. Right? Correct. Your working directory (files) switch over to whatever your local

Re: How to specify remote branch correctly

2012-12-16 Thread Tomas Carnecky
On Mon, 17 Dec 2012 16:13:08 +1100, Andrew Ardill andrew.ard...@gmail.com wrote: On 17 December 2012 16:06, Woody Wu narkewo...@gmail.com wrote: 1. git checkout foo. By this command, I think I am checking out files in my local branch named foo, and after that I also switch to the branch.

Re: How to specify remote branch correctly

2012-12-16 Thread Andrew Ardill
On 17 December 2012 16:30, Tomas Carnecky tomas.carne...@gmail.com wrote: 'git checkout foo' has special meaning if a local branch with that name doesn't exist but there is a remote branch with that name. In that case it's equivalent to: git checkout -t -b foo origin/foo. Because that's what

Re: How to specify remote branch correctly

2012-12-16 Thread Chris Rorvick
On Sun, Dec 16, 2012 at 11:52 PM, Andrew Ardill andrew.ard...@gmail.com wrote: This is true, but I don't think it is documented. I noticed this, too. I was just about to send a patch to add this. Chris -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to

Re: How to specify remote branch correctly

2012-12-16 Thread Woody Wu
On 2012-12-17, Andrew Ardill andrew.ard...@gmail.com wrote: On 17 December 2012 16:06, Woody Wu narkewo...@gmail.com wrote: 1. git checkout foo. By this command, I think I am checking out files in my local branch named foo, and after that I also switch to the branch. Right? Correct. Your

Re: How to specify remote branch correctly

2012-12-16 Thread Woody Wu
On 2012-12-17, Tomas Carnecky tomas.carne...@gmail.com wrote: On Mon, 17 Dec 2012 16:13:08 +1100, Andrew Ardill andrew.ard...@gmail.com wrote: On 17 December 2012 16:06, Woody Wu narkewo...@gmail.com wrote: 1. git checkout foo. By this command, I think I am checking out files in my local

Re: How to specify remote branch correctly

2012-12-16 Thread Tomas Carnecky
On Mon, 17 Dec 2012 07:02:46 +, Woody Wu narkewo...@gmail.com wrote: On 2012-12-17, Tomas Carnecky tomas.carne...@gmail.com wrote: 'git checkout foo' has special meaning if a local branch with that name doesn't exist but there is a remote branch with that name. In that case it's

Re: How to specify remote branch correctly

2012-12-16 Thread Woody Wu
On 2012-12-17, Tomas Carnecky tomas.carne...@gmail.com wrote: On Mon, 17 Dec 2012 07:02:46 +, Woody Wu narkewo...@gmail.com wrote: On 2012-12-17, Tomas Carnecky tomas.carne...@gmail.com wrote: 'git checkout foo' has special meaning if a local branch with that name doesn't exist but there