Thread (1 message) 1 message, 1 author, 2016-08-11

Re: Default modules to load ...

From: Linus Torvalds <torvalds@osdl.org>
Date: 2016-08-11 19:59:49


On Tue, 24 Oct 2006, Sean wrote:
Add Linus to CC so maybe you'll get better answers than I can offer.
The git list is probably even better.. Added to the Cc:
quoted
Hm. And why don't I find this in my regularly cloned and updated git
repository? I just noted that I wouldn't find this commit after a
'git-pull', but it would after a 'git-pull -t'.
"Git-pull -t" pulls down all remote tags (regardless of which branch
they're on) and then grabs all the commits they point to.  But it
won't actually pull down the full branch references.  Typically,
you don't ever need to use "-t".
Correct. 

Normally, git only tracks the branches you _asked_ it to track. It will 
follow any tags that happen along those branches, but it won't follow 
branches you haven't asked it to follow.

The reason is actually very simple: people track different things, and 
there is _not_ a 1:1 "local repository" to "parent repository" tracking. 
It's quite possible (and even sensible) to track two _different_ remote 
repositories in the same local repository, and adding branches just 
because the remote repository has a branch that you don't track, would 
actually be really _wrong_.
"Git-pull" pulls down all the new commits for the branches you're
following, and then any tags associated with any of the commits
you pulled.
Yes, again with the exception that it's limited to just branches you share 
with _that_ repository. This is important to understand not because it is 
important in itself, but because it explains the behaviour. Once you 
realize that there's not any real 1:1 relationship, the git behaviour 
makes sense, and anythign else would actually be a bad idea.

That said, we could possibly try to introduce a special _flag_ saying "add 
new branches from this remote repository automatically", if that is 
actually a common issue.
quoted
So this basically boils down to the question:

  How on earth am I supposed to keep up with an upstream repository, if
  'git-pull -t' is not doing enough? Nobody can't be suggesting doing a
  new git-clone all the time...
You shouldn't really ever need "git-pull -t"; just use "git pull".  It will
automatically grab all the tags you need.

But you will need to explicitly add new branches into your repo if you
want to follow them.  Perhaps Git could make this easier.
It actually is very easy already. You just need to be aware of the new 
branch you want to track (which you can either be when somebody just 
_tells_ you about it, or you can figure it out with "git ls-remote"), 
and then you just do

	git fetch origin remotebranch:localbranch

and you now have that branch locally.

Now, if you want to continue to _track_ that branch, you probably want to 
just tell git so explicitly, and the easiest way tends to just edit the 
".git/remotes/origin" file, which has such a simple format that I don't 
think you even need to read the documentation, and you will just _guess_ 
what you should do.

But yeah, if somebody wants to send Junio a

	git addbranch

script (a line or two of shell), go wild. It should be easy, and you'll 
get the satisfaction of being able to use a command that you know you 
wrote yourself!  It really isn't very complicated.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help