{"thread":{"id":"11853","subject":"Tips for different workflows/use cases","startedAt":"2008-02-03T15:08:07Z","lastAt":"2008-02-03T21:49:20Z","messageCount":2,"participants":["Guilhem Bonnefille","Dmitry Potapov"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"67216","messageId":"8b65902a0802030708i204d1714od850a59d9d25d0c1@mail.gmail.com","threadId":"11853","inReplyTo":null,"subject":"Tips for different workflows/use cases","fromName":"Guilhem Bonnefille","fromEmail":"guilhem.bonnefille@gmail.com","sentAt":"2008-02-03T15:08:07Z","receivedAt":"2008-02-03T15:08:07Z","isPatch":false,"sender":{"key":"guilhem.bonnefille@gmail.com","avatar":"https://gravatar.com/avatar/375364bfee1f61197c540e37465abe3619fc24eb3a36b0edcea7f15b124036b0?d=mp&s=160"},"body":"Hi,\n\n<my_life>\nUp to recently, I used Git as a frontend to many SVN repo. The\nworkflow is simple: a central SVN and a single \"client\" desktop.\nNow, I started to use Git at office. So I \"discover\" new problems and\nmy actual experience is not enougth.\n</my_life>\n\nActually, I discovered two(/three) use cases for which I'm looking the\nbest (recommended) workflows. My idea is to identify the best\npractices to avoid (as possible) complex situations.\n1- The same developer uses two repo on two network connected computers.\nFor any reason, a developer has to work on two computers for the same\nproject. He sometimes hack on both computers. He uses two git\nrepositories to keep it work in sync. Note: the two computers are\nconnected, and the developer can pull/push via ssh.\nSo, what is the best practices:\n- should he decide to push/pull every time from the same repo or\nshould he only use the \"pull\" command on each repo (and never push)\n- should he decide to create a third repo and use it as central repo.\n\n2- It's a variation of the previous one. Now, one of the two computers\nis a laptop. Is there any recommended practices to work with laptop?\n\n3- Now, the two computer are not connected via network. Two possible\nsolutions to sync our both computers: USB disk and e-mail.\nAny recommendation in this context?\n\n\nI think that such recommendations must be shared on the wiki, for\nexample on GitWorkflows or GitFaq pages.\n-- \nGuilhem BONNEFILLE\n-=- #UIN: 15146515 JID: guyou@im.apinc.org MSN: guilhem_bonnefille@hotmail.com\n-=- mailto:guilhem.bonnefille@gmail.com\n-=- http://nathguil.free.fr/\n"},{"id":"67265","messageId":"20080203214920.GW29522@dpotapov.dyndns.org","threadId":"11853","inReplyTo":"8b65902a0802030708i204d1714od850a59d9d25d0c1@mail.gmail.com","subject":"Re: Tips for different workflows/use cases","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2008-02-03T21:49:20Z","receivedAt":"2008-02-03T21:49:20Z","isPatch":false,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"On Sun, Feb 03, 2008 at 04:08:07PM +0100, Guilhem Bonnefille wrote:\n> So, what is the best practices:\n> - should he decide to push/pull every time from the same repo or\n> should he only use the \"pull\" command on each repo (and never push)\n\nIf both computers are always online and you can connect at will then\n\"pull\" is the simplest solution. The problem with \"push\" is that pushing\nto the local branch of another that has the working directory attached\nto it will give you not exactly what you want. The default refspec for\n\"push\" is only suitable for pushing into a \"bare\" repository from where\nanyone can pull. However, if you do not want to have a separate bare\nrepository for synchronization, you can avoid by providing suitable\nrefspec for push.\n\nLet's suppose that you have two computers (computer1 and computer2),\nand you can use computer1 to connect to computer2, but computer2 cannot\naccess to computer1.\n\nIn repository on computer1:\n\n  git remote add computer2 $COMPUTER2_URL\n  git config remote.computer2.push \"+refs/heads/*:refs/remotes/computer1/*\"\n\nPlease, note I used 'computer1' in the refspec above. It is the prefix\nfor local branches that will be added when they appear in the repository\non computer2. If you have only two computers then you can use 'origin'\ninstead of both 'computer1' and 'computer2' above, which will alow you\nto use push and pull without additional arguments.\n\nNow, you can safely push my changes from the current computer (computer1)\nto computer2:\n\n  git push computer2\n\nThen when you start working on computer2, you can either merge changes:\n\n  git merge computer1/master\n\nor if you want to have linear history then you have to use rebase your\nlocal changes on top of computer1\n\n  git rebase computer1/master\n\nNote: You should never rebase changes that you published (i.e. that you\nshare with other peoples), because rebase re-writes history.  Also, if\nthe first thing that you do when you change the computer is to merge\nchanges for another then you do not need ever use rebase and you still\nwill have linear history.\n\nNow, you back on computer1, and again you can either merge changes:\n\n git pull computer2\n\nor rebase local changes\n\n git pull --rebase computer2\n\nNote:\n 'git pull' is equivalent 'git fetch' and 'git merge'\n 'git pull --rebase' is equivalent 'git fetch' and 'git rebase'\n\n\n> - should he decide to create a third repo and use it as central repo.\n\nOften it makes sense to create an extra repo. After all, disk space\nis cheap and having extra backup never hurts.\n\n> \n> 2- It's a variation of the previous one. Now, one of the two computers\n> is a laptop. Is there any recommended practices to work with laptop?\n\nI suppose that laptop computer has limited online time. So, you have to\npush from it. You can push easier to a central \"bare\" repo, or directly\nto your other computer as I described above (laptop=computer1 and\nserver=computer2).\n\n> \n> 3- Now, the two computer are not connected via network. Two possible\n> solutions to sync our both computers: USB disk and e-mail.\n> Any recommendation in this context?\n\nSending patches by emails is good to exchange ideas or to contribute to\nmainstream, but you cannot synchronize repositories in this way. If\nyou really want to synchronize by emails, you should send bundles (man\ngit-bundle). Bundles can be transfered by emails or using any other\nmedia. Alternatively, you can have a copy of your repository on a USB\ndisk and synchronize with it using \"pull\" and \"push\" commands. However,\nif you use a USB disk with VFAT, you should mount it with 'shortname='\n'mixed' or 'winnt' on Linux.\n\n\nDmitry\n"}]}