From: Miklos Vajna Date: Tue, 17 Mar 2009 16:56:35 GMT Subject: Re: Mirroring repository state, with branches and submodules. 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 wrote: > 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.