Skip to contentSkip to conversation

Wishlist: git fetch --reference

DISCUSSION Howard Chu 3 participants 4 messages Jun 15, 2016

lore
Share & tools
lore

Howard Chu

author
#0 lore raw

I maintain multiple copies of the same repo because I keep each one checked out to different branch/rev levels. It would be nice if, similar to clone --reference, we could also use git fetch --reference to reference a local repo when doing a fetch to pull in updates.

Signature · 4 lines
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/
#1 lore raw
Quoted 4 lines · Howard Chu

I maintain multiple copies of the same repo because I keep each one checked out to different branch/rev levels. It would be nice if, similar to clone --reference, we could also use git fetch --reference to reference a local repo when doing a fetch to pull in updates.

Alternatively, you can use Duy's multiple-work-trees patches to safely make multiple checkouts of one repository. These patches are in next.

Signature · 2 lines
Dennis Kaarsemaker
http://www.kaarsemaker.net
#2 lore raw
In reply to Howard Chu
Quoted 4 lines · Howard Chu

I maintain multiple copies of the same repo because I keep each one checked out to different branch/rev levels. It would be nice if, similar to clone --reference, we could also use git fetch --reference to reference a local repo when doing a fetch to pull in updates.

I think it is just spelled:

echo $reference_repo >>.git/objects/info/alternates git fetch

We need "--reference" with clone because that first line needs to happen after clone runs "git init" but before it runs "git fetch". And if you cloned with --reference, of course, the alternates file remains and further fetches will automatically use it.

-Peff

author
#3 lore raw
Quoted 9 lines · Jeff King
Quoted 4 lines · Howard Chu

I maintain multiple copies of the same repo because I keep each one checked out to different branch/rev levels. It would be nice if, similar to clone --reference, we could also use git fetch --reference to reference a local repo when doing a fetch to pull in updates.

I think it is just spelled:

Quoted 7 lines

echo $reference_repo >>.git/objects/info/alternates git fetch

We need "--reference" with clone because that first line needs to happen after clone runs "git init" but before it runs "git fetch". And if you cloned with --reference, of course, the alternates file remains and further fetches will automatically use it.

Aha, thanks, hadn't realized that. Just checked and yes, the alternates file is already set in all of these different copies.

Signature · 4 lines
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/