Git development
 help / color / mirror / Atom feed
From: Petr Baudis <pasky@suse.cz>
To: Jakub Narebski <jnareb@gmail.com>
Cc: Anand Kumria <wildfire@progsoc.org>, git@vger.kernel.org
Subject: Re: when is a remote a branch?
Date: Tue, 14 Nov 2006 21:28:35 +0100	[thread overview]
Message-ID: <20061114202835.GJ7201@pasky.or.cz> (raw)
In-Reply-To: <200611121831.18851.jnareb@gmail.com>

On Sun, Nov 12, 2006 at 06:31:18PM CET, Jakub Narebski wrote:
> Petr "Pasky" Baudis wrote:
> > Git and Cogito share the same models of branches. These branches are
> > 'heads' with commit pointers stored in refs/heads/, etc. 
> 
> Not exactly. "Live" branches (i.e. branches you can commit to) are head
> refs stored in refs/heads/. But in repository cloned with git-clone
> --use-separate-remotes tracking heads (tracking branches) would be at
> refs/remotes/<remotename>/. You can fetch to such a ref, but you can't
> checkout it, nor commit to it.

That was meant to be the "etc". ;-))

> > The branches/ 
> > directory says that some branches do not correspond to local development
> > (and should never be used for that) but instead they correspond to a
> Does that _should_ is enforced in Cogito? Is it enforced in Git?

Yes (you cannot switch to it). No (AFAIK).

> > particular branch in some remote repository. Such branches are called
> > "REMOTE BRANCHES".
> 
> I'd rather call them "tracking branches", at least in git. So if there
> is branch 'localbranch' in refs/heads/ (?), and there is corresponding
> branches file branches/localbranch, which contains a single URL
>   git://host.domain/path/to/repository#remotebranch
> it is AFAICU equivalent to having some remotes file, named e.g. 'repo',
> with the following contents:
>   URL: git://host.domain/path/to/repository
>   Pull: remotebranch:localbranch
>   Push: remotebranch:localbranch
> or equivalent entry in git config.

Yes, except that the remote must be named 'localbranch'.

> > So it's "if branch X has corresponding .git/branch/X file, it's not a
> > local branch but instead a REMOTE BRANCH corresponding to the URL stored
> > in that file". That simple. The URL is address of the repository plus
> > optionally a '#branchname' if the branch name in the remote repository
> > should not default to remote HEAD or master.
> 
> The whole concept of branches file (and marking some branches as "remote"
> branches) is IMHO from the times where there were most common to have one
> live branch per repository, and we fetched and pushed single branches.
> This simple picture changed with more widespread use of multiple heads,
> and with the introduction of tags (I think).

I completely agree. The original remotes implementation was messy, but
with refs/remotes/ it's simple again. Only lack of time (or laziness) on
my side is why Cogito didn't move to this yet.

> By the way, with introduction of branches and remotes in config file,
> you can say:
>  [branch "localbranch"]
> 	remote = someremote
>  [remote "someremote"]
> 	fetch = remotebranch:localbranch
> 	push  = remotebranch:localbranch
> 
> and that would be equivalent to example branches file from the beginning
> of this email.

According to the documentation, this is not really useful since this
just tells what should git fetch default to when on branch
"localbranch". But "localbranch" is still just a branch representing a
state in a remote repository, so you should never be _on_ it in a sane
setup, but instead on a different branch which tracks it.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1

  reply	other threads:[~2006-11-14 20:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-12 15:50 when is a remote a branch? Anand Kumria
2006-11-12 16:11 ` Jakub Narebski
2006-11-12 16:36   ` Petr Baudis
2006-11-12 17:31     ` Jakub Narebski
2006-11-14 20:28       ` Petr Baudis [this message]
2006-11-14 20:36         ` Jakub Narebski
2006-11-14 20:44           ` Petr Baudis

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=20061114202835.GJ7201@pasky.or.cz \
    --to=pasky@suse.cz \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    --cc=wildfire@progsoc.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