1

I would like to mirror a repository A to a repository B and make some changes on B while synchronizing all changes made to A in B. What's the best approach to do that ?

Currently, I use git-mirror to mirror the repo A and push to B. But when I fetch for new changes from A and push them to B, all my works on B (new branches) are deleted. I always get a copy of A.

Thanks in advance for your help.

Pravine
  • 9
  • 2
  • Aren't you confusing clones and mirrors? Mirrors are a [subset](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---mirror) of clones. – Romain Valeri Feb 24 '20 at 10:39
  • @RomainValeri : No, I really nead a mirror at this level since I would like to sync the repo A to B. It's a one way sync. – Pravine Feb 24 '20 at 10:46

1 Answers1

0

The Git definition of a mirror is that it has no state of its own: it always replaces all of its information with the information from the site it's mirroring.

In other words, if B is a mirror of A, and you put something on B without putting it on A first, it will just vanish from B. Never put anything onto B; put it onto A, and it will mirror to B on the next mirror-update.

(If this is not the behavior you want, you do not want a mirror.)

torek
  • 448,244
  • 59
  • 642
  • 775