Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quickly sync'ing git workspace across computers

Tags:

git

dropbox

sync

I have a personal project using git that I often hack on across multiple computers, hosted on Github. Since I work on this at home I tend to get interrupted fairly often. I'll be in the middle of a statement, and dinner will be ready or I need to change a diaper. And when I get back to coding I may be on a different computer. What's the best way to get the most up-to-date version?

I think the most orthodox answer would be to commit and push. I commit fairly often but committing here seems messy to me. The code may be in a completely broken state where I was in the middle of a thought. To commit and publish it, even on a topic branch, doesn't seem right to me. It's also more steps than I would prefer.

Until now I've been using DropBox. But this appears to have lead me to a corrupt index. It's not hard to imagine because those syncs can be across different versions of git and different operating systems. So I'm afraid this it out.

Does anyone have a better alternative?

like image 534
mmalone Avatar asked Dec 25 '11 23:12

mmalone


People also ask

Is there a git-sync command?

git-sync is a simple command that pulls a git repository into a local directory.


2 Answers

An alternative to using Git to keep a codebase in sync across computers is to keep the actual codebase on your dropbox. Essentially, it just a local folder that's synchronised, so that whatever computer you're on (as long as you have saved your current work) it will be synced for you. It saves the step of pushing and pulling to a git repo on dropbox.

like image 175
Abizern Avatar answered Oct 01 '22 17:10

Abizern


I'd suggest writing a small script to rsync the required directories to all of the specified machines. Should be very simple and can be aliased so it's just a one liner from the terminal.

Where I work I do this often, dev on local machine using vhost to test but when I need to test on a mobile device, I can rsync everything to the public dev server and use the vhost there from the mobile device.

like image 22
sciritai Avatar answered Oct 01 '22 19:10

sciritai