DEV Community

How to keep all dev files in sync when switching computers constantly?

Omar Elbaga on June 13, 2020

We have about 100 projects and need to switch from office to home computer without feeling like anything is left behind on another computer. What i...
Collapse
 
omarel profile image
Omar Elbaga

Noting here. We ended up going the git route. There really wasn’t any other better way. I do wish there was an easier way to share all the git ignored files however. But overall git was a good solution. The ignored files are just problematic to share on all the projects with other developers.

Collapse
 
nnnikolov profile image
Nikolay Nikolov

Google Drive Enterprise provede exactly what you want, but it should be pricey. Git is not efficient for non text files and you should always keep in mind to push/pull befor/after switching or use a script. Check the cloud storage providers for best price/value ration and you should be ok.

Collapse
 
omarel profile image
Omar Elbaga • Edited

We have the gsuite. I tried it, but Google Drive constantly threw errors whenever I tried syncing and uploading dev files. Not sure why.

Collapse
 
nnnikolov profile image
Nikolay Nikolov

I am using Drive File Stream with our gsuite, not Drive for Desktop. It works pretty fine. The only limitation is the network connection because it act as a network drive.

Thread Thread
 
omarel profile image
Omar Elbaga

Same here. I'm not sure why I kept getting errors. It would skip certain folders and I couldn't figure out why. Mac would just throw an error that certain folders couldnt be uploaded.

Thread Thread
 
nnnikolov profile image
Nikolay Nikolov

That's the difference. I am only using it on Windows 10. Maybe there is something specific on Mac.

Thread Thread
 
omarel profile image
Omar Elbaga

Ah maybe.

Collapse
 
nirzaf profile image
Fazrin

Use Yandex Disk, It is damn smooth in Sycing between computers and even with mobiles, Trust me you won't be disappointed

Collapse
 
digizeph profile image
Mingwei Zhang

I use resilio sync to sync my dev folders for all my machines. Sometimes it gets crazy when I’m doing compilation tasks, like thousands of temporary files generated and deleted. In general, I just leave it running and never need to think I about synchronize folders. It also works on all platforms, and syncs with my Synology nas.

I started using it since it was called “bt sync” back then, and it has been working well enough that I have never thought about changing to other alternatives.

Collapse
 
omarel profile image
Omar Elbaga

Yeah I found these cloud sync solutions. What you're going through seems to be a common problem of these online sync solutions with dev files. I found some hacks of storing node_modules outside the sync directories, but it's kind of another hassle to deal with. I'm still testing. It would be great if a solution existed just for development. It would definitely take off.

Collapse
 
digizeph profile image
Mingwei Zhang

You can specify resilio to not sync certain folders, matched by regex I believe.

Collapse
 
matoval profile image
matoval

You could get an nas storage device that connects to your home network. I don't have one yet but I'm planning on getting one. Synology is the brand I'm looking at. SyntaxFM had an episode on it. syntax.fm/show/220/the-synology-sh...

Collapse
 
gwutama profile image
Galuh Utama • Edited

I wouldn't complicate things with synchronizing hundreds or even thousands of files over sync solutions like dropbox or google drive. In the company I'm working for, using these cloud drives to store files are forbidden (mostly because of GDPR issues). And sometimes synchronizing a lot of small files can take a long time and is less reliable than git.

So my solutions right now are:

  1. Laptops instead of work PCs. Bring the laptops home when you need to work from home.
  2. Remote PC solution with TeamViewer, VNC, Remote Desktop, etc to the office PC from home. Assuming that your internet connection from home is good.
Collapse
 
omarel profile image
Omar Elbaga

Hmm. I definitely appreciate your point of view. We're thinking of laptops, but you know the Team Viewer has always been kind of a hassle and it's not very productive. It's very slow and has other problems. It's good to do a quick thing, but if you really have to actually work through Team Viewer I would completely forget about that as an option.

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

How about rsync and external hard disk containing shell scripts?

Very useful when I wanted to include gitignored files as well as excluding node_modules.

Collapse
 
omarel profile image
Omar Elbaga

I'm not familiar with rsync. Worth checking out.

Collapse
 
blake profile image
Blake K

Have you considered developing on a remote environment/machine (via SSH) instead of your local machines? Visual Studio Code has an amazing plugin for this.

Collapse
 
phambatrungthanh profile image
Phạm Bá Trung Thành

For me, it's a combination of private VPS that I can SSH to and VS Code Remote Development.

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

How is it different from USB stick / external hard disk?

Collapse
 
omarel profile image
Omar Elbaga

Yeah would love to hear more about that option! @pacharapol I think it's different because you would leave the VPS connected to a main computer and I assume you could leave it in place and then any other computer could use that VPS remotely as a hard drive "in the cloud" by logging into it.

Collapse
 
phambatrungthanh profile image
Phạm Bá Trung Thành

Well, aside from keeping all your code in one place, you can have your git histories, commits without syncing, and you can run build jobs, run docker containers, deploy codes, forwarding ports to preview code from your local computer. Pretty much anything you can do on your local computer, you can do it on the remote cloud.

Collapse
 
ashutosh049 profile image
ashutosh049

Exactly! Foremost option is to go for some sort of versioning system(gitlab, github, bitbucket). Another option would be to use/install git over some remote machine and keep your code there. By this you need not keep/commit any local copy of file, everything would be on your server. You can just login to your machine and use it. Have not tried yet lol

Would love to hear other option.

Collapse
 
omarel profile image
Omar Elbaga

It seems like git could be a solution, but theres 2 problems with using GIt for this kind of thing. 1 is that with git we typically hide many folders whereas with syncing computers we need all files to match. 2. It's not really a real time sync. so we would need to keep committing constantly for little things done. It seems like git with some cloud syncing option is good, I'm looking into sync.com and dropbox syncing but still running into problems keeping these cloud folders loaded properly on local Apache servers

Collapse
 
nirzaf profile image
Fazrin

Use Yandex Disk, It is damn smooth in Sycing between computers and even with mobiles, Trust me you won't be disappointed, it has a free limitation upto 10GB but it is damn cheap for pro version as well

Collapse
 
mrrcollins profile image
Ryan Collins • Edited

How are the projects stored? Are they repos or just folders?

Besides the cloud services there are a couple of options.

Git is a pretty good solution for when the files are mostly text. You can use a script to sync every couple of minutes or use something like Sparkleshare.

There is also Syncthing.

Collapse
 
omarel profile image
Omar Elbaga • Edited

Git and folders, but git is overkill. Just keeping all files and folders in sync would be great. I found sync.com I'm testing it out. It seems like a potential solution, but I'm still playing with it.

Collapse
 
msfjarvis profile image
Harsh Shandilya

For dotfiles I honestly found Git to work best. For OS-level tooling I'm slowly migrating to NixOS as my operating system of choice since it lets me rebuild my PC to an exact previous state with just one configuration file which is amazingly helpful.

Collapse
 
filopd profile image
Priyesh Naik

I don't think it's worth to use GDrive/OneDrive for creating workspace.

  1. Keep your office pc locked and not power off and do RDP at home.
  2. Map your workspace with one folder with network sharing and use that instead of RDP.
  3. Add script that automatically commit the code to your custom repo.. check this stackoverflow.com/questions/420143...
Collapse
 
jerzakm profile image
Martin J

Have you tried AWS S3? It's not ready to go out of the box but you can configure it any way you want. I have a few batch scripts that I use to sync stuff with on a couple of my devices and it works well.

You should be mindful of the pricing with a large number of file transfers and size. It's also a good opportunity to poke around AWS if you haven't had the chance yet. They have a fairly generous free tier.

Collapse
 
kwstannard profile image
Kelly Stannard

You will probably want to write a script to loop through your repos and make a special commit and push.

Collapse
 
omarel profile image
Omar Elbaga • Edited

ooh that's kinda cool. I feel like git is not the perfect solution because for something like this because I'd want certain files to be sync across computers but that should be ignored in a repo.

Collapse
 
kwstannard profile image
Kelly Stannard

For that, there is Dropbox or maybe Google Drive.

Thread Thread
 
omarel profile image
Omar Elbaga

Yeah I'm playing with the dropbox syncing, but it's a little weird, it creates its own drive Whereas I have hundreds of projects running on a local server. It's kinda strange I guess I would have to move all the projects into the dropbox folder, but it works on some computers and not others because some computers use Lampp server and those are mounted and dismounted. It seems like dropbox cant exist in those type of environments. It's always something with this.

Collapse
 
brogrammerben profile image
Ben

Cloud storage accounts.

Collapse
 
omarel profile image
Omar Elbaga

Which ones do you recommend. I'm finding it difficult to have the cloud folders on the desktop coming from dropbox to be stored properly within the local servers.

Collapse
 
sarafian profile image
Alex Sarafian

The most complete solution I've ever seen was one from 15 years ago where my colleague would use a VM as his drv environment. Then he would use s USB stick are his transfer medium.

Collapse
 
omarel profile image
Omar Elbaga

Hmm I do appreciate it. I just feel like that's just not a good reliable real time option, having to constantly move files to a usb. No way I see that being reliable for us :) but appreciate it brother!!

Collapse
 
sarafian profile image
Alex Sarafian

Indeed, it doesn't much our accustomed is expectations.(that is why in mentioned the timeframe :) ) But, there as so many variables to consider that the os encapsulation is probably the only real solution which to be honest is why people use laptops as well.

Collapse
 
anibalardid profile image
Anibal

Git + Google Drive

Collapse
 
omarel profile image
Omar Elbaga

Seems like a good option, but the Google Drive Stream on mac has been rejecting many dev files unfortunately. I heard windows users are not having those issues.

Collapse
 
alan profile image
Alan

Gitpod.io :)