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

Re: Mirroring repository state, with branches and submodules.

From
Miklos Vajna <vmiklos@frugalware.org>
Date
Mar 17, 2009, 16:56 UTC
Message-ID
<20090317165635.GB3817@genesis.frugalware.org>
In-Reply-To
<623D3837-E899-49AF-9A37-F667A311EE58@gmail.com>
On Tue, Mar 17, 2009 at 03:21:40PM +0000, Toby White <toby.o.h.white@googlemail.com> wrote:
Show 6 quoted lines
> git fetch
> for BRANCH in $(git branch -r | cut -d / -f 2); do
>    git checkout $BRANCH
>    git reset --hard origin/$BRANCH
> done
> git submodule update --init

First, I think you don't handle the case when you have multiple remotes. I don't know if this is a problem for you or not.

Second, use plumbing in scripts, git for-each-ref has a stable output format, while git branch may change.

Previous: Toby White
Message 2 of 2 in “Mirroring repository state, with branches and submodules.”
  1. Toby WhiteMar 17, 2009
  2. Miklos VajnaMar 17, 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.