Mirroring repository state, with branches and submodules.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux