merge two local mirrors with detached heads and similar remotes

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

 



I wish to merge two local mirrors, which each should share the same
object store, and I have been reading for many hours and so far failed
to achieve.

I did learn  git remote add, and applied my knowledge to another local
git clone/ mirror as can be seen here:
$ cd bananajour.git/
$ git remote -v
eadz    https://github.com/eadz/bananajour.git (fetch)
eadz    https://github.com/eadz/bananajour.git (push)
fresh   https://github.com/freshtonic/bananajour.git (fetch)
fresh   https://github.com/freshtonic/bananajour.git (push)
origin  https://github.com/toolmantim/bananajour.git (fetch)
origin  https://github.com/toolmantim/bananajour.git (push)
ts      https://github.com/tswicegood/bananajour.git (fetch)
ts      https://github.com/tswicegood/bananajour.git (push)
$ gb -a
* master
  remotes/eadz/master
  remotes/eadz/railscamp-hackfest
  remotes/fresh/bigbananajour
  remotes/fresh/master
  remotes/fresh/railscamp-hackfest
  remotes/origin/HEAD -> origin/master
  remotes/origin/macruby
  remotes/origin/master
  remotes/origin/railscamp-hackfest
  remotes/origin/v3
  remotes/ts/master
  remotes/ts/railscamp-hackfest


So I want to achieve the same thing (multiple remotes in one local
repo) for an earlier clone of two separate repos, which really ought
to be just one, as follows:

A)
$ cd gitjour.git/
$ cat .git/config
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = https://github.com/chad/gitjour.git
[branch "master"]
        remote = origin
        merge = refs/heads/master
$ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master

B)
$ cd gitjour-new.git/
$ cat .git/config
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = https://github.com/lachlanhardy/gitjour.git
[branch "master"]
        remote = origin
        merge = refs/heads/master
$ git branch -a
* master
  remotes/origin/8.2.0
  remotes/origin/HEAD -> origin/master
  remotes/origin/lachlanhardy
  remotes/origin/master
  remotes/origin/v8.1.0


I tried, by copying each repo A) and B) into t/ and u/ respectively, then:
$ cd t
$ git remote add lach ../u
$ git fetch latch

but I only get three resulting branches, not the expected 6:
$ gb -a
* master
  remotes/lach/master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master


I'm still learning my terminology sorry, but it seems that the origin
branches in u/ are detached heads or something. That's fine, I just
want them to appear in my t/ mirror.

I realise that I will need to update t/.git/config so that the "lach"
remote points to its canonical/ web URL, but _first_ I want to get all
the refs and objects from my local version, before hooking it up to
the web for future updates. I want to take advantage of the download
I've already done.

(Notwithstanding the fact that these repos are barely a few hundred
KiB, I also need to do this job because my 18-month old linux repos
are in a similar situation - I want to save my disk space by combining
my Ubuntu Hardy linux repo (with it's branches/ heads), and a couple
others, with my canonical Linus linux repo, into one. I did use the
--reference option back when I made these repos respectively, to share
and to minimize download as much as possible, but it seems that what I
really want is a properly shared (single) repo with multiple remotes,
so I don't have to think about what sequence of locals to download
etc.

In this vein, a chapter in the tutorial, perhaps near 'recommended
workflows', on Repository Mirroring Best Practices might be in order.

TIA
Zenaan
--
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]