tags:

views:

5804

answers:

6

Is there a good tutorial where I can learn using git+dropbox together effectively?

A: 

Git is used for distributed version control. Dropbox is more of a filesync. I think if you can use git, then you dont need to use Dropbox other than for its cool drag and drop features. I don't really see a use for putting a git repository in a dropbox folder, other than for maybe working on the same code base and origin using two different systems.

Ritesh M Nayak
Yes, however, version control can never be an excuse for not keeping **backups**.
Alan Haggai Alavi
And vice versa.
jleedev
@jleedev: Absolutely.
Alan Haggai Alavi
Dropbox gives you 1) instant backups on Amazon S3 2) access from multiple computers regardless of firewalls. It's a lot more than just "cool drag and drop". If you don't see a need to use git over Dropbox, you probably haven't tried using git over Dropbox.
Ates Goral
+57  A: 

I think that git on dropbox is great. I use it all of the time. I have multiple computers (two at home and one at work) that I use dropbox as a central bare repo. Since I don't want to host it on a public service and I don't have access to a server that I can always ssh to, Dropbox takes care of this by syncing (very quickly) in the background.

Setup is something like this:

~/project $ git init
~/project $ git add .
~/project $ git commit -m "first commit"
~/project $ cd ~/Dropbox/git

~/Dropbox/git $ mkdir project.git
~/Dropbox/git $ cd project.git
~/Dropbox/git $ git init --bare
~/Dropbox/git $ cd ~/project

~/project $ git remote add origin ~/Dropbox/git/project.git
~/project $ git push origin master

From there, you can just clone ~/Dropbox/git/project.git that you have associated with your dropbox account (or have shared this dir with people), you can do all the normal git operations and they will be synced to all your other machines automatically.

I wrote a blog post on my reasoning and how I set up my environment, it's based on my Rails development experience, but can be applied to anything, really.

Dan McNevin
Thanks! This is exactly what I was looking for. :)
zero4
I wonder what'll happen if you push to the dropbox bare repo from two machines at the same time. If it'll cause a modification in one of git's internal files, dropbox will show you there's a conflict -- but what do you do then? Just pick one of the versions, and then push again from both machines (one by one)?
dubek
@dubek: You'll probably end up corrupting the shared bare repo. This approach is only suitable for a small team (two in my case) where people can just shout over their cubicle walls: "Hey! Nobody push! I'm pushing now!".
Ates Goral
@Ates: At least git is decentralized, so if you manage to corrupt things you can restore it from someone's local copy. If you have a big team, chances are that there's enough cash for a hosted repo somewhere.
rdrey
@rdey: True. You can always create local tags and revert if something gets screwed up. That's the power of git!
Ates Goral
+3  A: 

Dropbox already retains old versions of files, so it makes for a weird match with git.

Greg Bacon
Are you sure? INSIDE THE REPO, does GIT use new files or update files as versions move ahead?
Yar
@yar Some of both. Even objects, although immutable, can move from loose to packed format or become garbage to be deleted entirely. Other metadata files such as $GIT_DIR/refs/heads/master change with every commit.
Greg Bacon
Wow. That's very informative and would make dropbox terrible for sharing. I wrote a question on this today. http://stackoverflow.com/questions/2199637
Yar
But the motive is to use Dropbox as a "network share on steroids". Dropbox already having change history is a moot point.
Ates Goral
A: 

@Dan McNevin:

thank you for your interesting answer! Do you see any problems with having your repo in Dropbox and nowhere else? I don't want to pull and push always. All I want Dropbox for, is having a backup solution and being able to work from multiple computers. Help appreciated. Max

Max
This is coming from a Rails perspective, so it might be different depending on what you're developing in.. The problem with working directly in Dropbox is that there will be constant changes to the files there, logs, tmp files, sqlite database changes, etc.. that you might not want to always be synced up with your other machines that share the same Dropbox. I like to use Dropbox as more of a central repo.. I do all of my work in the "local" (ie not in the Dropbox folder) cloned repo, and then push the changes up to Dropbox at a good stopping point.
Dan McNevin
+1  A: 

I don't think that using git and dropbox is the way to go... Just think about the features of both:

Git:

  • Allows you to have a central repository;
  • Allows you to have your own repository with your own changes;
  • Allows you to send and receive changes from the central repository;
  • Allows multiple persons to change the same files and them merges them or asks you to merge them if it can't do it;
  • Has web and desktop clients to allow access to the central repository;

Dropbox:

  • Keeps everything in a central repository;
  • Allows you to have your own versions of the files in the server;
  • Forces you to send and receive changes from the central repository;
  • If multiple persons change the same files, the first file committed is replaced with later commits, and no merge occurs which is troublesome; (And definitely it's biggest disadvantage)
  • Has web and desktop clients to allow access to the central repository.

And if your worried with sharing some of your files, why not cipher them? And them you could get the biggest advantage of dropbox to git, that is to have public and private files...

Coyote21
+1  A: 

We use this method (creating a bare repository in Dropbox) on a share folder.

A small group of developers can pull from that bare synced repository and create a local clone. Once the unit of work is done, we push back to origin.

One thing I'm missing is a good way to have an e-mail sent with the change-set information once a push to origin occurs. We are using Google Wave to manually keep track of changes.

dengel
Somebody's using Google Wave?
Kristopher Johnson