git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How to specify remote branch correctly

From
TCTomas Carnecky <tomas.carnecky@gmail.com>
Date
Dec 17, 2012, 05:30 UTC
Message-ID
<1355722245-ner-6603@calvin>
In-Reply-To
<CAH5451kmTW+nO4V4pjSdaqhHAb=RX-tawLo=rJfuPnDRDWeSEA@mail.gmail.com>
On Mon, 17 Dec 2012 16:13:08 +1100, Andrew Ardill <andrew.ardill@gmail.com> wrote:
Show 9 quoted lines
> On 17 December 2012 16:06, Woody Wu <narkewoody@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 branch 'foo' points to, and your HEAD is updated to point to
> your local branch 'foo'. Unless something goes wrong/you have
> conflicting files/uncommitted changes etc.

'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 people usually want.

Previous: Andrew ArdillNext: Andrew Ardill
Message 5 of 11 in “How to specify remote branch correctly”
  1. Woody WuDec 17, 2012
  2. Andrew ArdillDec 17, 2012
  3. Woody WuDec 17, 2012
  4. Andrew ArdillDec 17, 2012
  5. Tomas CarneckyDec 17, 2012
  6. Andrew ArdillDec 17, 2012
  7. Chris RorvickDec 17, 2012
  8. Woody WuDec 17, 2012
  9. Tomas CarneckyDec 17, 2012
  10. Woody WuDec 17, 2012
  11. Woody WuDec 17, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.