git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: when is a remote a branch?

From
Petr Baudis <pasky@suse.cz>
Date
Nov 12, 2006, 16:36 UTC
Message-ID
<20061112163624.GE7201@pasky.or.cz>
In-Reply-To
<ej7h1n$ed8$1@sea.gmane.org>
On Sun, Nov 12, 2006 at 05:11:41PM CET, Jakub Narebski wrote:
Show 13 quoted lines
> Read Documentation/repository-layout.txt (ot it's HTML version, either
> locally ot at www.kernel.org).
> 
>  branches::
>          A slightly deprecated way to store shorthands to be used
>          to specify URL to `git fetch`, `git pull` and `git push`
>          commands is to store a file in `branches/'name'` and
>          give 'name' to these commands in place of 'repository'
>          argument.
> 
> You can store only one branch to fetch per shorthand. I'm not sure about
> where it is stored which branch to download, and how to name this branch 
> locally.

I think the above is quite confusing description. This really is not about any "shorthands" at all, but just about branches (how the name implies, after all).

Git and Cogito share the same models of branches. These branches are 'heads' with commit pointers stored in refs/heads/, 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 particular branch in some remote repository. Such branches are called "REMOTE BRANCHES".

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.

In addition, Git (not Cogito at this point) supports a completely different and unrelated abstraction called REMOTES. They don't have anything to do with branches. Instead, a REMOTE represents a repository URL and a set of local/remote branch pairs to handle on pulls and pushes; it has no other obvious mapping to branches and branches can be even shared between various REMOTES etc. (this is changing lately with the refs/remotes/ hierarchy, but I think that's still not in wide use).

-- 
				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
Previous: Jakub NarebskiNext: Jakub Narebski
Message 3 of 7 in “when is a remote a branch?”
  1. Anand KumriaNov 12, 2006
  2. Jakub NarebskiNov 12, 2006
  3. Petr BaudisNov 12, 2006
  4. Jakub NarebskiNov 12, 2006
  5. Petr BaudisNov 14, 2006
  6. Jakub NarebskiNov 14, 2006
  7. Petr BaudisNov 14, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.