From: Marc Branchaud <marcnarc@xiplink.com>
To: Michael J Gruber <git@drmicha.warpmail.net>
Cc: Peter Harris <git@peter.is-a-geek.org>, git@vger.kernel.org
Subject: Re: Working with remotes; cloning remote references
Date: Tue, 21 Oct 2008 11:17:30 -0400 [thread overview]
Message-ID: <48FDF28A.9060606@xiplink.com> (raw)
In-Reply-To: <48FDA5A0.8030506@drmicha.warpmail.net>
Michael J Gruber wrote:
>
>> clone/$ git config remote.origin.fetch \
>> '+refs/remotes/ThingOne/*:refs/remotes/ThingOne/*'
>
> If you want to fetch main's local branches also, use option "--add" here
> so that you don't override the default fetch refspec (forgot last time,
> sorry).
Okay, got it.
> I thought you wanted to avoid pulling directly from ThingOne to clone?
Ah, I see (part of) our disconnect here -- sorry for not explaining it
clearly before!
Yes, indeed, I do want to pull directly from ThingOne into the clone.
The scenario is that there's a bunch of us sharing the main repo, and
when some upstream changes happen in ThingOne I'd like for one of us to
be able to clone the main repo, pull the changes from ThingOne into the
clone (fixing any conflicts; remember that we have our own changes in
ThingOne's code), then push the merged changes back to main for everyone
else to grab.
> If you pull directly you might as well set up the same remote config as
> on main: for the correct pull line you need to know the same info as for
> the correct remote config.
Yes, I see that -- it's why I'm basically satisfied with being able to do
clone/$ git pull -s subtree /path/to/ThingOne master
from the clone, and all I'm doing now is kvetching about having to
remember the location and branch of ThingOne when that was already
configured in main (and thanks for being patient with my kvetching!).
> git fetch
> git merge -s subtree remotes/ThingOne/master
>
> should do the trick.
AFAICT that only refers to the clone's local branch for the ThingOne
repo. The above git-config command doesn't add the ThingOne repo's URL
to the clone, so I'm still stuck having to use that URL directly to pull
changes from ThingOne into the clone. (And when I use the URL directly,
I have to use a branch name that's defined in the ThingOne repo. I'd
like to also be able to use whatever branch name got set up in main when
"git remote add" was run.)
> If that works you can set up things so that pulling
> from origin (pulling when you're in your integration branch) does that
> merge automatically, using branch.integrationbranch.remote=origin,
> branch.integrationbranch.merge=remotes/ThingOne/master (untested ;) ).
>
> To be clear: The idea here is that main decides which ThingOne branch to
> store in remotes/ThingOne/master and where to get it from; clones always
> pull that one.
I think that "where to get it from" part is what I'm going on about.
There doesn't seem to be a way for the main repo to tell the clone where
the ThingOne repo is, so that the clone can pull in ThingOne changes
directly.
>> I just feel that there are some
>> situations where you want the origin's remotes in your clone, and some
>> where you don't, and git should let you decide.
>
> Well, it let's you decide: It tracks local branches by default, and
> using additional "git config" you can track remotes as well. You can
> also use the "--mirror" option to "git clone" or "git remote add", but
> that has other side effects.
I think we're mis-communicating, mainly because I'm not yet able to
express things well in git-speak. Let me give it another stab...
I believe git lets you track the origin's _branches_ not the origin's
_remotes_. I don't think --mirror does what I'm looking for, because
(side effects aside) it only deals with branches, not remotes.
I find myself getting confused, and I think it's because the files in
.git/refs/remotes/ are indeed tracking branches on remote repositories.
So I think our conversation gets a bit circular because our ideas of a
"remote" differ.
"git remote add" does two things (maybe more?): It adds a [remote]
section to the .git/config file, and it adds a branch reference in
.git/refs/remotes/. I think what I'd like is for the clone to be able
to obtain both these things from the origin. The reason I think it's
useful is that it would let the clone pull directly from the origin's
remote repositories, without having to directly specify the remote
repository's URL and branch name.
Fundamentally, I'm looking to do exactly
clone/$ git pull -s subtree /path/to/ThingOne master
i.e. pull stuff from one of main's remotes directly into the clone. But
I want to replace the "/path/to/ThingOne master" part with something
that means "use whatever URL and branch name was defined in the origin
for this remote".
My questions are: Am I right in thinking this is desirable? Is there
already some way to do this? If not, is it something worth
implementing? (I'm happy to roll up my own sleeves here...)
I hope that clarifies things. Sorry for taking so long to get here!
Marc
next prev parent reply other threads:[~2008-10-21 15:18 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-16 18:17 Working with remotes; cloning remote references Marc Branchaud
2008-10-16 19:20 ` Peter Harris
2008-10-16 20:29 ` Marc Branchaud
2008-10-16 20:45 ` Peter Harris
2008-10-16 22:09 ` Marc Branchaud
2008-10-17 7:33 ` Michael J Gruber
2008-10-17 14:44 ` Marc Branchaud
2008-10-17 15:08 ` Michael J Gruber
2008-10-17 19:50 ` Marc Branchaud
2008-10-20 13:22 ` Michael J Gruber
2008-10-20 16:50 ` Marc Branchaud
2008-10-21 9:49 ` Michael J Gruber
2008-10-21 15:17 ` Marc Branchaud [this message]
2008-10-22 14:59 ` Michael J Gruber
2008-10-22 16:13 ` Terminology question: "tracking" branches Björn Steinbrink
2008-10-23 8:07 ` Michael J Gruber
2008-10-27 15:43 ` Marc Branchaud
2008-10-27 16:17 ` Björn Steinbrink
2008-10-27 18:44 ` Johannes Schindelin
2008-10-27 16:28 ` Björn Steinbrink
2008-10-28 8:01 ` Björn Steinbrink
2008-10-27 19:54 ` Working with remotes; cloning remote references Marc Branchaud
2008-10-28 8:12 ` Michael J Gruber
2008-10-28 16:27 ` Marc Branchaud
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=48FDF28A.9060606@xiplink.com \
--to=marcnarc@xiplink.com \
--cc=git@drmicha.warpmail.net \
--cc=git@peter.is-a-geek.org \
--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).