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

Re: [RFC] git-clone: add --track <headname> support

From
MLMartin Langhoff <martin@catalyst.net.nz>
Date
Apr 12, 2007, 23:50 UTC
Message-ID
<461EC5DC.6060903@catalyst.net.nz>
In-Reply-To
<87slb5tbvu.wl%cworth@cworth.org>
Carl Worth wrote:
Show 8 quoted lines
> Is this correct sequence for the operation in 1.5.1 ?
> 
> 	git clone <repo>
> 	cd <project>
> 	git branch --track <branch> origin/<branch>
> 	git checkout branch
> 	git pull # as needed
> 
Actually you don't need the git-checkout line
	git clone <repo>
	cd <project>
	git branch --track <branch> origin/<branch>
	git pull # as needed
Show 5 quoted lines
> I'd love to get that down to:
> 
> 	git clone <something with <repo> and <branch>>
> 	cd <project>
> 	git pull # as needed
That's what this patch does.
Show 5 quoted lines
> and then adding a subsequent branch to track would be:
> 
> 	git track <something with <repo> and <branch>>
> 	git checkout <branch>
> 	git pull # as needed

If your tree is reasonably clean (so that the implied git-checkout won't fail), then on 1.5.1 this Just Works

        git branch --track <branch> origin/<branch>
        git pull # as needed
cheers,
m
-- 
-----------------------------------------------------------------------
Martin @ Catalyst .Net .NZ  Ltd, PO Box 11-053, Manners St,  Wellington
WEB: http://catalyst.net.nz/           PHYS: Level 2, 150-154 Willis St
OFFICE: +64(4)916-7224  UK: 0845 868 5733 ext 7224  MOB: +64(21)364-017
      Make things as simple as possible, but no simpler - Einstein
-----------------------------------------------------------------------
Previous: Carl WorthNext: Junio C Hamano
Message 7 of 9 in “[RFC] git-clone: add --track <headname> support”
  1. Martin LanghoffApr 12, 2007
  2. Junio C HamanoApr 12, 2007
  3. Martin LanghoffApr 12, 2007
  4. Carl WorthApr 12, 2007
  5. Martin LanghoffApr 12, 2007
  6. Carl WorthApr 12, 2007
  7. Martin LanghoffApr 12, 2007
  8. Junio C HamanoApr 13, 2007
  9. Junio C HamanoApr 13, 2007

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.