12

When I'm at work I use my macbook, but at home I prefer to use my imac. When we were using subversion, all I had to do was put my working directory inside my dropbox folder, and it would sync up my two computers without a problem. I could stop working on my macbook at work (without committing or pushing), then pick up where I left off on my imac at home, finish what I was working on, and commit my changes from home. From either computer, it's treated like I'm doing all my work on that same computer.

So I want dropbox to house my local working directory and to be synced across my computers. I do NOT want to use my dropbox folder as my origin master (which is mostly what I found when I googled for this). I'm happy using github for that. I just want to be able to switch from computer to computer without a hiccup.

We switched to git and it doesn't work this same way for some reason. I get crazy errors with conflicts all over the place. It's like the git information isn't actually housed inside the dropbox folder... or maybe dropbox isn't seeing and syncing changes because of how git manipulates timestamps on files (guessing here).

Anybody have any idea why this works differently with git and what I could do to get the same behavior again?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Bob Ralian
  • 1,949
  • 1
  • 20
  • 29
  • Checkout the questions under "related" on the right, such as http://stackoverflow.com/questions/3632723/git-with-dropbox – Tyler Dec 22 '10 at 17:14
  • 1
    That link specifically talks about using Dropbox to host the central repo... and Bob specifically said he wasn't interested in that! – Ryan Dec 02 '11 at 02:31

3 Answers3

2

If you're using github (or any other git hosting service, as long as you can access it from both places), then just clone the central repository from github on your work computer, and clone it again from your home computer. When you're done making changes, push them to the central repo, and then pull then when you get to your other computer. True, this requires you to commit first, and if you're working on a team then you don't want to publish "work in progress" commits. Maybe make a branch in the central repo that only you use, and keep your WIP commits there.

Using dropbox seems weird to me. There should definitely be a way to do what you want to do using only git.

Tyler
  • 21,762
  • 11
  • 61
  • 90
  • 4
    With svn I was able to just stop working on one computer and start work on another. No need to do a WIP commit. And that's what I'm looking for... the ability to just pick up where I left off on my other computer without having to do a commit. – Bob Ralian Dec 23 '10 at 06:37
  • I see where you're coming from, but making a commit is not as big of a deal in git as it is in svn. People say git changes the way you think. The way I think is: If you're at a place where you can stop what you're doing and come back to it when you get home that night, then you should make a commit to keep track of where you are. You can always throw that commit away later. But I think you could just put your git repository (with checked-out working tree) in Dropbox if you wanted to. It just seems weird. – Tyler Dec 23 '10 at 07:30
  • 4
    It seems weird to me that this doesn't sound like an obvious thing people would want to do. Having to commit and push just to continue work from another computer seems weird to me. Dropbox does an excellent job of syncing most things, but not git repos. That is what seems weird to me! – Ryan Dec 02 '11 at 02:33
0

I was working on two laptops and a workstation and so a lot of my work was incomplete as I was constantly on the move, I didn't have time to commit WIP and so I decided to look into dropbox.

github repos With my github repos, I committed my WIP, then I cloned the entire repository into my Dropbox folder.

local git repos I just moved the entire folder across which copies the necessary git files as well. If you can do without your git history (e.g. new repo), just delete the .git contents of your folder before moving it to your dropbox to reduce the size of the synching.

Hope this helps

Coderama
  • 11,050
  • 12
  • 44
  • 58
0

Brad Wright has written an excellent tutorial on using Git with Dropbox.

urschrei
  • 25,123
  • 12
  • 43
  • 84
  • 1
    I did something similar with mercurial, but ended up losing work that one time I closed my laptop after a local commit but before the dropbox sync was complete. I then continued working on another computer and eventually generated dropbox conflicts inside the .hg folder. **Not good**. – Wim Coenen Dec 22 '10 at 23:46
  • 2
    As I understand, he's basically using dropbox as an alternative to github. That's not really what I want to do. That still requires a commit and push whenever he wants to switch to another computer. I just want my remote to live inside dropbox and sync to a service like github. But I want to avoid having to do a work-in-progress commit or check-in when I switch to my other computer. Again, this was possible with svn, and I'm not sure why it's not working the same way with git. – Bob Ralian Dec 23 '10 at 06:43