+Git keeps surprising me. Sometimes this is good. Sometimes I’m less convinced. For example, I have some bare repositories that I want to keep up to date with upstream versions, against which I’m running some reporting scripts. Of course, since they are bare repositories, I can’t “git pull”; I have to “git fetch”. But it is much less obvious that “git fetch”, while it will fetch changes to existing refs, by default will not also pull in new upstream refs unless I “git fetch origin +refs/heads/:refs/heads/” because when you clone into a bare repository, it doesn’t set up the “fetch” configuration for the remote. Could someone tell me why it is obvious that cloning into a bare repository should set up the origin remote including its URL but leave off the default fetch specification that you would otherwise get?

H. Peter Anvin June 26, 2013 13:11

I think you want to enable the mirror option (git clone –mirror).

Michael K Johnson June 26, 2013 13:15


Clearly, that’s what I was meant to have known existed…

I guessed clone –bare because of using init –bare and it didn’t occur to me that I ought to search for a different option.

H. Peter Anvin June 26, 2013 13:19

Yeah, -bare by itself is at the best of limited use.  It sort of makes sense - it behaves exactly like a normal clone except it sets it up to be bare; –mirror was added later to also set up everything else to be a proper mirror.

H. Peter Anvin June 26, 2013 13:19

OK, how the fsck does one avoid G+ making stupid formatting decisions?  ;)

Michael K Johnson June 26, 2013 13:31

The easiest way to say it is that I wasn’t aware of the entire design concept for “bare”; I thought of it as “without a working directory” but didn’t have the rest of the concept, so it seemed confusing to me. Judging from the number of hits when I searched for help suggesting that people explicitly pull the refs on the command line and the  paucity of suggestions to use –mirror, I think I’m not alone in missing the point here.

They did seem to improve the dash-for-italics logic to not trigger on solely leading dashes as in command line options, and for the use you had above, an em-dash would be typographically correct. That’s usually compose-dash-dash-dash — if you remember TeX, that makes sense. (See what I did there? ☺) Anyway, the compose key is key (groan) to avoiding stupid formatting decisions in G+…

Imported from Google+ — content and formatting may not be reliable