{"thread":{"id":"22214","subject":"Syncing a git working tree with Dropbox?","startedAt":"2010-01-13T23:57:18Z","lastAt":"2010-01-14T13:40:49Z","messageCount":4,"participants":["chombee","Tay Ray Chuan","Geoffrey Lee"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"131550","messageId":"20100113235718.GA7033@dulip","threadId":"22214","inReplyTo":null,"subject":"Syncing a git working tree with Dropbox?","fromName":"chombee","fromEmail":"chombee@lavabit.com","sentAt":"2010-01-13T23:57:18Z","receivedAt":"2010-01-13T23:57:18Z","isPatch":false,"sender":{"key":"chombee@lavabit.com","avatar":null},"body":"I've heard of people keeping a bare repo in their Dropbox folder\n(https://www.dropbox.com/) and pushing to and pulling from it, letting\nDropbox sync the bare repo between their machines. In other words using\nDropbox as a form of hosting for a private git repo. What I want to do\nis sort of the other way around.\n\nI keep on getting into the following mess: I have some changes in my\nworking tree on machine A, I stop working on machine A and don't commit\nand push the changes (to my remote, 'central' bare repo) either because\nthey're not ready yet, or I forget to commit or push. Later on I arrive\nat machine B which has its own clone of the same repo, but because I\ndidn't commit and push the changes on machine A I don't have access to\nthem on machine B and I can't continue working on them. The two machines\nare physically located far away from each other and they're not\naccessible over the internet. Argh!\n\nDropbox is a proprietary sync service that gets around this problem\nbecause it automatically syncs your files whenever you save them. But I\nstill want to keep my project in a git repo. I'm assuming that keeping\nthe actual .git folder in a Dropbox folder, so that when git makes\nchanges inside the .git folder Drobox syncs them, would be a bad idea.\nIt seems like taking two different synchronisation systems and mashing\nthem into each other. But what about just the working tree?\n\nMy idea is that I keep my .git folder safely outside of my Dropbox\nfolder, but my git repository has a detached working tree that is\nlocated in the Dropbox folder. On machine B it would be the same setup.\nSo the two machines each have their own clone of the git repo and these\nare synchronised by git push and git pull with a 'central' remote repo.\nBut the two clones share the same working tree, or more accurately their\nworking trees are synced by Dropbox.\n\nThe working tree is just files, I don't see how it's different from\nDropbox syncing any other files. Dropbox and git ought not to collide in\nany way. So this should work fine shouldn't it?\n\nThis way I don't need to commit and push my changes until they're\nready/I remember to, but whenever I move from machine A to machine B my\nuncommitted changes will still be available to me because Dropbox has\nsynced my working tree automatically.\n"},{"id":"131583","messageId":"be6fef0d1001132139p56944cdax22674ca773af0199@mail.gmail.com","threadId":"22214","inReplyTo":"20100113235718.GA7033@dulip","subject":"Re: Syncing a git working tree with Dropbox?","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2010-01-14T05:39:10Z","receivedAt":"2010-01-14T05:39:10Z","isPatch":false,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"Hi,\n\nOn Thu, Jan 14, 2010 at 7:57 AM, chombee <chombee@lavabit.com> wrote:\n> My idea is that I keep my .git folder safely outside of my Dropbox\n> folder, but my git repository has a detached working tree that is\n> located in the Dropbox folder. On machine B it would be the same setup.\n> So the two machines each have their own clone of the git repo and these\n> are synchronised by git push and git pull with a 'central' remote repo.\n> But the two clones share the same working tree, or more accurately their\n> working trees are synced by Dropbox.\n>\n> The working tree is just files, I don't see how it's different from\n> Dropbox syncing any other files. Dropbox and git ought not to collide in\n> any way. So this should work fine shouldn't it?\n\nYour changes in git (like new commits) won't be synced.\n\n-- \nCheers,\nRay Chuan\n"},{"id":"131640","messageId":"83d7aaa41001140519g2f84199j38bd0e9a5c73953@mail.gmail.com","threadId":"22214","inReplyTo":"be6fef0d1001132139p56944cdax22674ca773af0199@mail.gmail.com","subject":"Re: Syncing a git working tree with Dropbox?","fromName":"Geoffrey Lee","fromEmail":"geoffreyj.lee@gmail.com","sentAt":"2010-01-14T13:19:08Z","receivedAt":"2010-01-14T13:19:08Z","isPatch":false,"sender":{"key":"geoffreyj.lee@gmail.com","avatar":"https://gravatar.com/avatar/eda7290effb2fe936a54951db47d049adf71d6bd41b70c56dd9dedc8f3327c39?d=mp&s=160"},"body":"On Wed, Jan 13, 2010 at 9:39 PM, Tay Ray Chuan <rctay89@gmail.com> wrote:\n> On Thu, Jan 14, 2010 at 7:57 AM, chombee <chombee@lavabit.com> wrote:\n>> My idea is that I keep my .git folder safely outside of my Dropbox\n>> folder, but my git repository has a detached working tree that is\n>> located in the Dropbox folder. On machine B it would be the same setup.\n>> So the two machines each have their own clone of the git repo and these\n>> are synchronised by git push and git pull with a 'central' remote repo.\n>> But the two clones share the same working tree, or more accurately their\n>> working trees are synced by Dropbox.\n>>\n>> The working tree is just files, I don't see how it's different from\n>> Dropbox syncing any other files. Dropbox and git ought not to collide in\n>> any way. So this should work fine shouldn't it?\n>\n> Your changes in git (like new commits) won't be synced.\n\nYou have to sync your .git directory. For example, using your setup,\nif you switch branches on Machine A, your working directory will\nchange on Machine B, but Machine B will still think it's on the\nprevious branch. This scenario would cause a lot of problems for Git.\n\nThere shouldn't be any problems with placing your entire repository\n(working tree and .git directory) inside Dropbox as long as you only\nuse one computer at a time.\n\n-Geoffrey Lee\n"},{"id":"131641","messageId":"20100114134049.GA16445@dulip","threadId":"22214","inReplyTo":"83d7aaa41001140519g2f84199j38bd0e9a5c73953@mail.gmail.com","subject":"Re: Syncing a git working tree with Dropbox?","fromName":"chombee","fromEmail":"chombee@lavabit.com","sentAt":"2010-01-14T13:40:49Z","receivedAt":"2010-01-14T13:40:49Z","isPatch":false,"sender":{"key":"chombee@lavabit.com","avatar":null},"body":"Ok, I was aware that I would have to sync the .git directories also, but\nmy plan was to do that in the normal way (git pull and git push) but\nsync the working tree automatically with Dropbox. However, I'm now\nimagining all kinds of mind-bending problems this might cause. If I\ncommit and push some changes on machine A, and Dropbox syncs the working\ncopy, then I go to machine B, git status will show that machine B has\nchanges to commit, until I do git pull on machine B. As Geoffrey points\nout, changing branches could be even worse!\n\nIn any case, I've had problems with detached working trees. With an\nolder version of git it was refusing to checkout a detached working\ntree. I upgraded git and checkout worked, but it refused to do git pull.\n\nAh well.\n\nI'm not too sure about keeping the .git directory itself in Dropbox.\nGoogling it, it seems lots of people do it without any problems, but\nthere are some reports of it going haywire.\n\nOn Thu, Jan 14, 2010 at 01:39:10PM +0800, Tay Ray Chuan wrote:\n> Hi,\n> \n> On Thu, Jan 14, 2010 at 7:57 AM, chombee <chombee@lavabit.com> wrote:\n> > My idea is that I keep my .git folder safely outside of my Dropbox\n> > folder, but my git repository has a detached working tree that is\n> > located in the Dropbox folder. On machine B it would be the same setup.\n> > So the two machines each have their own clone of the git repo and these\n> > are synchronised by git push and git pull with a 'central' remote repo.\n> > But the two clones share the same working tree, or more accurately their\n> > working trees are synced by Dropbox.\n> >\n> > The working tree is just files, I don't see how it's different from\n> > Dropbox syncing any other files. Dropbox and git ought not to collide in\n> > any way. So this should work fine shouldn't it?\n> \n> Your changes in git (like new commits) won't be synced.\n> \n> -- \n> Cheers,\n> Ray Chuan\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n\nOn Thu, Jan 14, 2010 at 05:19:08AM -0800, Geoffrey Lee wrote:\n> On Wed, Jan 13, 2010 at 9:39 PM, Tay Ray Chuan <rctay89@gmail.com> wrote:\n> > On Thu, Jan 14, 2010 at 7:57 AM, chombee <chombee@lavabit.com> wrote:\n> >> My idea is that I keep my .git folder safely outside of my Dropbox\n> >> folder, but my git repository has a detached working tree that is\n> >> located in the Dropbox folder. On machine B it would be the same setup.\n> >> So the two machines each have their own clone of the git repo and these\n> >> are synchronised by git push and git pull with a 'central' remote repo.\n> >> But the two clones share the same working tree, or more accurately their\n> >> working trees are synced by Dropbox.\n> >>\n> >> The working tree is just files, I don't see how it's different from\n> >> Dropbox syncing any other files. Dropbox and git ought not to collide in\n> >> any way. So this should work fine shouldn't it?\n> >\n> > Your changes in git (like new commits) won't be synced.\n> \n> You have to sync your .git directory. For example, using your setup,\n> if you switch branches on Machine A, your working directory will\n> change on Machine B, but Machine B will still think it's on the\n> previous branch. This scenario would cause a lot of problems for Git.\n> \n> There shouldn't be any problems with placing your entire repository\n> (working tree and .git directory) inside Dropbox as long as you only\n> use one computer at a time.\n> \n> -Geoffrey Lee\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"}]}