How can I put my git working directory inside dropbox so I can seamlessly work from any dropbox-enabled computer without committing?
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 worki开发者_JAVA技巧ng 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?
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.
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
Brad Wright has written an excellent tutorial on using Git with Dropbox.
精彩评论