From: Junio C Hamano <junkio@cox.net>
To: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: Default remote branch for local branch
Date: Sun, 02 Apr 2006 14:40:48 -0700 [thread overview]
Message-ID: <7v7j67k65b.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <200604021817.30222.Josef.Weidendorfer@gmx.de> (Josef Weidendorfer's message of "Sun, 2 Apr 2006 18:17:29 +0200")
Josef Weidendorfer <Josef.Weidendorfer@gmx.de> writes:
> On Saturday 01 April 2006 06:18, Pavel Roskin wrote:
>> On Fri, 2006-03-31 at 19:05 -0800, Junio C Hamano wrote:
>> > Maybe you would want something like this.
>> >
>> > In $GIT_DIR/config:
>> >
>> > [pull]
>> > origin = linus for master
>> > origin = irq-pio of libata for ata-irq-pio
>> > origin = pata-drivers of libata for ata-pata
>
> Let me try to understand this: the general idea is that
>
> pull.origin = [<refspec> of] <remote> for <branch>
>
> specifies the default action of git-pull if we are on <branch>, ie.
> a "git pull" then runs "git pull <remote> [<refspec>]".
Not quite.
It will be (if this were a serious proposal -- I am not
absolutely convinced this is a good idea) more like "git fetch
<remote>" followed by "git-merge HEAD the-refspec-named-there".
The implementation of the above would involve changes to
git-fetch, because it needs to give ".not-for-merge" mark to
different line in FETCH_HEAD depending on [<refspec> of] part.
> So the example above, if .git/remotes/linus would contain two
> refspecs, and you are on the branch of the 2nd refspec, it would
> do the wrong thing: merge the 1st refspec with current branch.
Sorry I fail to visualize this part.
>> Secondly, I think the relationship should be between a local development
>> branch and a local tracking branch.
>
> Agree.
> It is also useful to specify this relation if the upstream is purely a
> local branch, e.g. when branching off a local branch, and you want to
> pull in changes from the local upstream.
>
> This works automatically if git-pull only does upstream fetching if
> there is a remote branch associated. The default action of git-fetch
> similar could be "fetch the upstream branch, if that tracks a remote
> branch", using the same configuration.
Interesting.
You would need sanity checker for $GIT_DIR/remotes/* files if
you do this to make sure no local tracking branch is by mistake
configured to track two remote branches, which is a good change,
but then:
git-pull, without parameter, would:
(1) check if this branch has any local branch it usually
merges from; if not, do whatever we traditionally
did (or barf).
(2) if there is a local branch it merges from, check if
it is a tracking branch for a remote, by looking at
remotes/* files. It would be nice if we could
detect tracking branches fed from external svn/cvs
repositories via svn/cvs-import this way at this
time. If not, skip the next step and go directly to
(4).
(3) run git-fetch (or svn/cvs-import) to update the
tracking branch;
(4) merge from that other local branch.
> Junio's proposal has the advantage that you do not have to search in all
> files in .git/remotes (and even .git/branches) for the remote branch that
> maps to a given local branch.
> But that is not the big issue.
A bigger thing is that I am trying to avoid _requiring_ tracking
branches. If you are not micromanaging your subsystem
maintainers, you should not have to care where they were the
last time you pulled from them. You should be able to just
pull, examine what the merge brings in, and decide it is worth
merging. If it isn't, do a "reset", tell them "not good, please
rework and let me know when you are ready," and forget about it.
If we are going require tracking branches, we could do a bit
more with them, like remembering where the tip was when we
fetched the last time (or the time before that...) and diff with
that, but the tracking branch heads are not set up to do things
like that right now -- they are single pointers.
>> Perhaps you are missing a remotes editor command?
Perhaps. Also perhaps a remotes/ sanity checker.
Something like this:
$ git branch --describe ata-pata
Typically merges from pata-drivers branch of
git://.../jgarzik/libata-dev.git
which is tracked with local refs/remotes/libata/pata-drivers.
$ git branch --decribe refs/remotes/libata/pata-drivers
Tracking branch for pata-drivers branch of
git://.../jgarzik/libata-dev.git
$ git checkout origin
warning: you are checking out a tracking branch for "master" branch of
warning: git://.../torvalds/linux-2.6.git
warning: commit/pull/merge commands are disabled.
hint: you can still create a new branch from here.
next prev parent reply other threads:[~2006-04-02 21:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-01 1:48 Default remote branch for local branch Pavel Roskin
2006-04-01 3:05 ` Junio C Hamano
2006-04-01 4:18 ` Pavel Roskin
2006-04-02 16:17 ` Josef Weidendorfer
2006-04-02 21:40 ` Junio C Hamano [this message]
2006-04-02 23:28 ` Josef Weidendorfer
2006-04-03 7:56 ` Andreas Ericsson
2006-04-03 9:38 ` Josef Weidendorfer
2006-04-03 10:03 ` Andreas Ericsson
2006-04-03 8:23 ` Junio C Hamano
2006-04-03 13:57 ` Josef Weidendorfer
2006-04-14 16:16 ` Petr Baudis
2006-04-14 18:26 ` Josef Weidendorfer
2006-04-01 5:38 ` Jakub Narebski
2006-04-01 19:57 ` 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=7v7j67k65b.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=Josef.Weidendorfer@gmx.de \
--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