From: Toby White <toby.o.h.white@googlemail.com>
To: git@vger.kernel.org
Subject: Mirroring repository state, with branches and submodules.
Date: Tue, 17 Mar 2009 15:21:40 +0000 [thread overview]
Message-ID: <623D3837-E899-49AF-9A37-F667A311EE58@gmail.com> (raw)
I have a short script which does the following for a remote git
rpository:
Clones it (checking out a working tree)
Makes tracking local branches for all remote branches
Init/updates all submodules.
This gives me an up-to-date mirror of a remote repository. I treat
this as essentially read-only.
What I now want to do is have some command which will update this
local mirror to reflect exactly the state of the remote mirror;
even when the remote mirror may have rebased history.
So far, I'm doing the following:
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
but I'm not sure if that's actually the right way to do it, or if I'm
missing any corner cases. Am I safe to use it?
Thanks,
Toby
next reply other threads:[~2009-03-17 15:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-17 15:21 Toby White [this message]
2009-03-17 16:56 ` Mirroring repository state, with branches and submodules Miklos Vajna
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=623D3837-E899-49AF-9A37-F667A311EE58@gmail.com \
--to=toby.o.h.white@googlemail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox