Fetching everything in another bare repo
- From
Paul Smith <paul@mad-scientist.net>
- Date
- Mar 8, 2023, 22:39 UTC
- Message-ID
- <6215dde710670fdf0da3ba0549429eaa32db257b.camel@mad-scientist.net>
Apologies if this is the wrong list.
I have a tool that wants to preserve every commit and never garbage collect (there are references that need to be maintained to older commits/branches that have been deleted). This tool keeps its own bare clone, and disables all GC and maintenance on it.
Unfortunately a month or so ago, by accident someone re-cloned the primary copy of the repo that everyone else uses as this bare clone, which lost the old history.
The good news is that I have a copy of the original bare clone with all the history intact.
So now what I want to do is fetch the old data into the current bare clone (since the old clone doesn't have the newest stuff). And, I need to be sure that all commits are pulled, and kept, and nothing is cleaned up. I would also like any deleted branches to re-appear, but I don't want to change the location of any existing branches in the new repo.
Is it sufficient to run something like this:
git fetch --no-auto-maintenance --no-auto-gc <path-to-old-clone>
?? Are there other options I should consider? Is it better to fetch the NEW clone into the OLD clone, than to fetch the old clone into the new clone (the new data is much more important to preserve)?
Since this is a one-off operation I don't care so much about making the fetch fast.
Thanks!