{"thread":{"id":"39290","subject":"Multiple push remotes via aliases","startedAt":"2015-05-10T18:17:03Z","lastAt":"2015-05-11T14:17:58Z","messageCount":4,"participants":["brian m. carlson","Junio C Hamano","Michael Haggerty"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"260930","messageId":"20150510181703.GC225482@vauxhall.crustytoothpaste.net","threadId":"39290","inReplyTo":null,"subject":"Multiple push remotes via aliases","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2015-05-10T18:17:03Z","receivedAt":"2015-05-10T18:17:03Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"I recently discovered that it was possible to specify multiple push URLs\nfor a remote.  This is useful for me because some of my projects live\nboth on GitHub and on my own server, and some live only one place or the\nother.\n\nOne feature that I'm looking for, however, is the ability to specify\nthose URLs by reference to another remote.  For example, making the\nremote def (default) refer to the remotes gh and upstream instead of\nduplicating the URLs.  This makes dealing with URL changes easier and\ngoes along with the DRY approach.\n\nI don't think we already have this functionality (at least I don't see\ncode for it), and I'd like to implement it, but maybe the documentation\nis just missing and I should submit a patch for that instead.  Do we\nhave such a thing, and if not, do people think this is a worthwhile\nfeature?\n-- \nbrian m. carlson / brian with sandals: Houston, Texas, US\n+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only\nOpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187\n"},{"id":"260931","messageId":"xmqq4mnkgtj0.fsf@gitster.dls.corp.google.com","threadId":"39290","inReplyTo":"20150510181703.GC225482@vauxhall.crustytoothpaste.net","subject":"Re: Multiple push remotes via aliases","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-05-10T18:46:27Z","receivedAt":"2015-05-10T18:46:27Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"brian m. carlson\" <sandals@crustytoothpaste.net> writes:\n\n> I recently discovered that it was possible to specify multiple push URLs\n> for a remote.  This is useful for me because some of my projects live\n> both on GitHub and on my own server, and some live only one place or the\n> other.\n>\n> One feature that I'm looking for, however, is the ability to specify\n> those URLs by reference to another remote.\n\nTwo issues that immediately comes to my mind are\n\n (1) how you deal with a misconfiguration that makes a loop;\n\n (2) how would you disambiguate a local directory and a nickname.\n\nI do not think either is insurmountable and as long as clean\nsolutions for them are implemented I would say \"why not?\" for the\nnew feature.  Of course there may be other issues other than these\ntwo knee-jerk ones.\n"},{"id":"260932","messageId":"20150510191045.GD225482@vauxhall.crustytoothpaste.net","threadId":"39290","inReplyTo":"xmqq4mnkgtj0.fsf@gitster.dls.corp.google.com","subject":"Re: Multiple push remotes via aliases","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2015-05-10T19:10:45Z","receivedAt":"2015-05-10T19:10:45Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Sun, May 10, 2015 at 11:46:27AM -0700, Junio C Hamano wrote:\n> \"brian m. carlson\" <sandals@crustytoothpaste.net> writes:\n> \n> > I recently discovered that it was possible to specify multiple push URLs\n> > for a remote.  This is useful for me because some of my projects live\n> > both on GitHub and on my own server, and some live only one place or the\n> > other.\n> >\n> > One feature that I'm looking for, however, is the ability to specify\n> > those URLs by reference to another remote.\n> \n> Two issues that immediately comes to my mind are\n> \n>  (1) how you deal with a misconfiguration that makes a loop;\n\nI was certain you were going to ask this.  My plan is to only allow one\nlevel of reference as a first pass and check for the current remote\nname.  If there's a desire to extend it to multiple levels, we can\nimplement loop checking then.  A list of already-seen entries could be\nused in that case.\n\n>  (2) how would you disambiguate a local directory and a nickname.\n\nI was going to do something like this:\n\n[remote \"def\"]\n\treference = upstream\n\treference = gh\n\nThe same rules for \"def\" would apply that are currently used, and\n\"upstream\" and \"gh\" would clearly be references, not remote URLs.\n\nI had planned to essentially make \"git push def\" work like \"git push\nupstream; git push gh\", forbidding fetch and push entries at the\nsame time as reference entries.  Future work could use referenceURL to\nrefer only to the URL and allow fetch and push to be used.\n\nI'm also going to update the documentation to reflect that multiple push\nURLs can be specified, as it seems that's a well-kept secret.\n-- \nbrian m. carlson / brian with sandals: Houston, Texas, US\n+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only\nOpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187\n"},{"id":"260971","messageId":"5550BA16.2090304@alum.mit.edu","threadId":"39290","inReplyTo":"20150510181703.GC225482@vauxhall.crustytoothpaste.net","subject":"Re: Multiple push remotes via aliases","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2015-05-11T14:17:58Z","receivedAt":"2015-05-11T14:17:58Z","isPatch":false,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"-----BEGIN PGP SIGNED MESSAGE-----\nHash: SHA1\n\nOn 05/10/2015 08:17 PM, brian m. carlson wrote:\n> I recently discovered that it was possible to specify multiple push\n> URLs for a remote.  This is useful for me because some of my\n> projects live both on GitHub and on my own server, and some live\n> only one place or the other.\n> \n> One feature that I'm looking for, however, is the ability to\n> specify those URLs by reference to another remote.  For example,\n> making the remote def (default) refer to the remotes gh and\n> upstream instead of duplicating the URLs.  This makes dealing with\n> URL changes easier and goes along with the DRY approach.\n> \n> I don't think we already have this functionality (at least I don't\n> see code for it), and I'd like to implement it, but maybe the\n> documentation is just missing and I should submit a patch for that\n> instead.  Do we have such a thing, and if not, do people think this\n> is a worthwhile feature?\n\nFor fetching, we already have\n\n> remotes.<group> The list of remotes which are fetched by \"git\n> remote update <group>\". See git-remote(1).\n\nISTM that your feature is akin to this one and could piggyback on the\nsame configuration. By analogy with \"git remote update <group>\", the\ncorresponding command could be\n\n    git remote push <group> [...]\n\nYou suggested being able to run something like\n\n    git push <group> [...]\n\nwhich is a little bit shorter. If so, then it is natural to ask\nwhether <group> should be allowed in place of <repo> whenever it makes\nsense, as a general UI principle. If so, then\n\n    git fetch <group> [...]\n\ncould be shorthand for \"git remote update <group> [...]\".\n\nBut please note that I haven't thought about whether the <repo> ->\n<group> generalization could be done consistently, vs. whether the\ngroupwise commands are different enough from the single-repo commands\nthat the supposed generalization would be more confusing than useful.\n\nMichael\n\n- -- \nMichael Haggerty\nmhagger@alum.mit.edu\n\n-----BEGIN PGP SIGNATURE-----\nVersion: GnuPG v2\n\niEYEARECAAYFAlVQuhUACgkQwg9mrRwfmAkFbQCghrQhBaerq0W7suJzu0cr7RGW\nCy0AoIkvgbWmOnwJfeldk73vNMPbc197\n=arW/\n-----END PGP SIGNATURE-----\n"}]}