loading...

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

omarel profile image Omar Elbaga ・1 min read

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 is your best way to keep all dev files and assets for many projects in sync across 2-3 computers? I realize git is a potential solution. I just don't know if it's the true solution for the situation, unless it is? We have so many assets and projects being worked on. I can't imagine having to remember to commit on every project and if there's a commit left behind, etc.

What are your thoughts fellow devs!

Discussion

pic
Editor guide
 

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.

 

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

 

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.

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.

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

Ah maybe.

 

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.

 

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

 

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.

 

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.

 

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.

 

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

 

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.

 

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...
 

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.

 

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.
 

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.

 

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.

 

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

 

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.

 

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.

 

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...

 

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

 

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

 

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.

 

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.

 

Cloud storage accounts.

 

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.

 

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

 

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.

 

For that, there is Dropbox or maybe Google Drive.

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.

 

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.

 

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!!

 

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.

 

Git + Google Drive

 

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.

 

Gitpod.io :)