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

Re: how to clone all branches include remote branches

From
Johannes Gilger <heipei@hackvalue.de>
Date
Feb 10, 2009, 18:05 UTC
Message-ID
<gmsflm$sd4$1@ger.gmane.org>
In-Reply-To
<95463c700902100949w23a95536re9a65a2e5c3c0b5d@mail.gmail.com>
On 2009-02-10, gnu kevin <kevin.gnu.zhang@gmail.com> wrote:
Show 6 quoted lines
> I'd like to know how to get all remote(grandparent) branches by clone
> a remote repo . for example:
> remote repo ABC contains below branches:
> master
> stable/main
> dev/main

You could (if your .git/config) already contains the remote simply add a line: fetch = +refs/remotes/*:refs/remotes/<remote-name>/remotes/*

The double remotes is used so that no remote-remote-branch can overwrite your tracking branch with the same name.

Hope that helped, Jojo

-- 
Johannes Gilger <heipei@hackvalue.de>
http://hackvalue.de/heipei/
GPG-Key: 0x42F6DE81
GPG-Fingerprint: BB49 F967 775E BB52 3A81  882C 58EE B178 42F6 DE81
Previous: gnu kevin
Message 2 of 2 in “how to clone all branches include remote branches”
  1. gnu kevinFeb 10, 2009
  2. Johannes GilgerFeb 10, 2009

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.