From: Zenaan Harkness <zen@freedbms.net>
To: git@vger.kernel.org
Subject: Re: merge two local mirrors with detached heads and similar remotes
Date: Sun, 7 Nov 2010 20:27:50 +1100 [thread overview]
Message-ID: <AANLkTi=JmpXEiEe-7-ZicUp-QosWjTZQgK77-f=9iAtL@mail.gmail.com> (raw)
In-Reply-To: <AANLkTinidbrJjmt5w=TyFGMyNpaGobE1iDBm3VAWmZvX@mail.gmail.com>
On Sun, Nov 7, 2010 at 13:40, Zenaan Harkness <zen@freedbms.net> wrote:
> I wish to merge two local mirrors, which each should share the same
> object store
...
> 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
> [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
> [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
It looks to me like I finally solved the first half of the problem,
with clarification from the following URL:
http://www.gelato.unsw.edu.au/archives/git/0601/15567.html
In A) I modified .git/config to be as follows:
$ 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
[remote "lach"]
url = ../u
# fetch = +refs/heads/*:refs/remotes/origin/*
fetch = +refs/remotes/origin/*:refs/remotes/lach/*
$ git fetch lach d
remote: Counting objects: 583, done.
remote: Compressing objects: 100% (303/303), done.
remote: Total 568 (delta 229), reused 566 (delta 229)
Receiving objects: 100% (568/568), 65.29 KiB, done.
Resolving deltas: 100% (229/229), completed with 3 local objects.
From ../u
* [new branch] origin/8.2.0 -> lach/8.2.0
* [new branch] origin/HEAD -> lach/HEAD
* [new branch] origin/lachlanhardy -> lach/lachlanhardy
* [new branch] origin/v8.1.0 -> lach/v8.1.0
# and finally:
$ git branch -a
* master
remotes/lach/8.2.0
remotes/lach/HEAD
remotes/lach/lachlanhardy
remotes/lach/master
remotes/lach/v8.1.0
remotes/origin/HEAD -> origin/master
remotes/origin/master
---------
Looks very much like success to me. Small thing I notice is this line:
remotes/origin/HEAD -> origin/master
has become this:
remotes/lach/HEAD
(ie it's not a link any more - probably not particularly relevant,
perhaps git gc would automate tidying this?)
----------
So now I just update the remote URL for lach to point back to upstream
and I think I'm done. Happy days.
That tutorial email URL up top above might be old -
http://www.gelato.unsw.edu.au/archives/git/0601/15567.html is from
January 2006! - and is out of date a bit wrt the .git/config file
format (eg remotes wildcards), BUT in that email, Junio explained this
"local mirror" concept well enough that I could solve my problem here
(it appears) - implementing a fixup of my "local mirror" use case -
I'm a happy camper; thank you Junio!
May be I missed how to do this somewhere in the docs already, but I've
been reading and searching the web for two days, learning lots for
sure, but frustrated that it took me so long to find out how to do
this.
Should something like Junio's tutorial go into
Documentation/gitworkflows.xml(ARGGH!) ?
If not, where else?
Is there anything besides vim (about all I know) you can recommend for
editing xml(ARGGH!) docs?
Thanks
Zenaan
next prev parent reply other threads:[~2010-11-07 9:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-07 2:40 merge two local mirrors with detached heads and similar remotes Zenaan Harkness
2010-11-07 9:27 ` Zenaan Harkness [this message]
2010-11-07 9:42 ` Zenaan Harkness
2010-11-07 11:52 ` Jakub Narebski
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='AANLkTi=JmpXEiEe-7-ZicUp-QosWjTZQgK77-f=9iAtL@mail.gmail.com' \
--to=zen@freedbms.net \
--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;
as well as URLs for NNTP newsgroup(s).