{"thread":{"id":"22597","subject":"RFC: git sync","startedAt":"2010-02-10T03:27:20Z","lastAt":"2010-02-10T19:47:03Z","messageCount":4,"participants":["Larry D'Anna","Jakub Narebski","Sergio"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"134111","messageId":"20100210032720.GA5205@cthulhu","threadId":"22597","inReplyTo":null,"subject":"RFC: git sync","fromName":"Larry D'Anna","fromEmail":"larry@elder-gods.org","sentAt":"2010-02-10T03:27:20Z","receivedAt":"2010-02-10T03:27:20Z","isPatch":false,"sender":{"key":"larry@elder-gods.org","avatar":"https://avatars.githubusercontent.com/u/3013304?v=4"},"body":"So say you have a project with a bunch of branches.  You have two main computers\nyou work on: a laptop and a workstation, and you keep an authoritative copy on a\nserver somewhere.  When you sit down at your laptop to work on your project, the\nfirst thing you want to do is make sure that whatever you've got locally is\nup-to-date with the repo on the server.  So you run: \n\ngit push origin :\n\nThen if it says anything isn't a fast-forward, you use some combination of git\npull, git checkout, or git fetch to get all you branches up to date, then\npossibly you run the push again to push merges back to the server.\n\nHow about instead we add a new command called \"git sync\" that does all that for\nyou?  So if you say \n\ngit sync origin : \n\nIt matches refs just like git-push would, but it will also automatically\nfast-forward your local refs if possible.  (and update the worktree+index if\nHEAD is one of the local refs that gets fast forwarded).  If any merges would\nbe required, it will print a warning and leave that ref alone.\n\nAnd if you say\n\ngit sync --merge origin :\n\nit will try to merge any refs that need it.  If the merge succeeds, it will be\nexactly as if you had said\n\ngit checkout foobranch\ngit pull origin foobranch\ngit push origin foobranch\n\nWhat do you all think?  If you like the idea, I'll do it as a builtin.\nOtherwise I'll just hack up a perl script for myself.\n\n\n          --larry\n"},{"id":"134134","messageId":"m3wryl8lkp.fsf@localhost.localdomain","threadId":"22597","inReplyTo":"20100210032720.GA5205@cthulhu","subject":"Re: RFC: git sync","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-02-10T09:52:51Z","receivedAt":"2010-02-10T09:52:51Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Larry D'Anna <larry@elder-gods.org> writes:\n\n> So say you have a project with a bunch of branches.  You have two main computers\n> you work on: a laptop and a workstation, and you keep an authoritative copy on a\n> server somewhere.  When you sit down at your laptop to work on your project, the\n> first thing you want to do is make sure that whatever you've got locally is\n> up-to-date with the repo on the server.  So you run: \n> \n> git push origin :\n> \n> Then if it says anything isn't a fast-forward, you use some combination of git\n> pull, git checkout, or git fetch to get all you branches up to date, then\n> possibly you run the push again to push merges back to the server.\n> \n> How about instead we add a new command called \"git sync\" that does all that for\n> you?  So if you say \n> \n> git sync origin : \n\n[...]\n> What do you all think?  If you like the idea, I'll do it as a builtin.\n> Otherwise I'll just hack up a perl script for myself.\n\nWhy not use the recpie from GitFaq:\n\"How would I use \"git push\" to sync out of a host that I cannot pull from?\"\nhttp://git.wiki.kernel.org/index.php/GitFaq#How_would_I_use_.22git_push.22_to_sync_out_of_a_host_that_I_cannot_pull_from.3F\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"134149","messageId":"loom.20100210T173300-230@post.gmane.org","threadId":"22597","inReplyTo":"m3wryl8lkp.fsf@localhost.localdomain","subject":"Re: RFC: git sync","fromName":"Sergio","fromEmail":"sergio.callegari@gmail.com","sentAt":"2010-02-10T16:39:14Z","receivedAt":"2010-02-10T16:39:14Z","isPatch":false,"sender":{"key":"sergio.callegari@gmail.com","avatar":"https://gravatar.com/avatar/c98f41317e0422c1e630385de0e3970227b8e5ad15f35ba8586066467cc833bc?d=mp&s=160"},"body":"> Why not use the recpie from GitFaq:\n> \"How would I use \"git push\" to sync out of a host that I cannot pull from?\"\n>\nhttp://git.wiki.kernel.org/index.php/GitFaq#How_would_I_use_.22git_push.22_to_sync_out_of_a_host_that_I_cannot_pull_from.3F\n> \n\nHi, to follow that recipe with more than one satellite, all sharing the same\nconfig, it would be just great to be able to put $hostname in .git-config, e.g.\n\n[remote \"mothership\"]\n   url = <url>\n   push = master:refs/remotes/$hostname/master\n\nWould there be any potential problem with that?\n"},{"id":"134171","messageId":"20100210194703.GA5451@cthulhu","threadId":"22597","inReplyTo":"m3wryl8lkp.fsf@localhost.localdomain","subject":"Re: RFC: git sync","fromName":"Larry D'Anna","fromEmail":"larry@elder-gods.org","sentAt":"2010-02-10T19:47:03Z","receivedAt":"2010-02-10T19:47:03Z","isPatch":false,"sender":{"key":"larry@elder-gods.org","avatar":"https://avatars.githubusercontent.com/u/3013304?v=4"},"body":"* Jakub Narebski (jnareb@gmail.com) [100210 04:53]:\n> Why not use the recpie from GitFaq:\n> \"How would I use \"git push\" to sync out of a host that I cannot pull from?\"\n> http://git.wiki.kernel.org/index.php/GitFaq#How_would_I_use_.22git_push.22_to_sync_out_of_a_host_that_I_cannot_pull_from.3F\n\nBecause that has nothing whatsoever to do with the problem I'm trying to solve.\n\nI'm trying to make a common task more automated and convenient.  It's not like I\ndon't know how to perform it manually.\n\n      --larry\n"}]}