DEV Community

fred321f
fred321f

Posted on

Syncing my "htdocs"-folder between two computers?

Hey guys.

I have an amazing laptop that I bring everywhere I go, in order to be able to jump into the coding whenever I get a fresh new idea.

I have been having some troubles lately, since I can't seem to find a liable way of syncing my "htdocs"-folder between to computers.

My Desktop-PC at home uses an Apache-server to host the website while it's in developement, and my laptop uses XAMPP to host the website.

I have been using a USB-storage device for moving and replacing the htdocs-folder each time I switch computers, but that just feels too wonky and old-school for me.

DO any of you guys have any experience with solutions for this? I thas to be rather affordable, as I am currently studying and working part-time. It also has to be reliable and easy to use.
I have thought of investing in a NAS-system to host the htdocs-folder on, but that does not seem to be the right thing to do..

Any input is appreciated.
Thanks!

  • Frederick

Top comments (8)

Collapse
 
vdsmartin profile image
Martin Vandersteen

Why not just use git ?

Collapse
 
okayfrederick profile image
fred321f

Well.. I looked into this, but I didn't feel like it was the right solution..

With git, is it possible for me to just pull the code I pushed from my other computer, into my XAMPP or apache directory? And does it replace the folder, or just copy from Git repo and into the directory?

Collapse
 
sroehrl profile image
neoan • Edited

Even better: GIT will be the fastest solution as it only updates changes rather than the complete project. Additionally, you have a unified history so you can roll back changes regardless of which computer you used. Start simple and you will see that it's perfect. Soon you'll jump into branching and other features that will make you join the millions of devs that wouldn't live without it anymore

Collapse
 
vdsmartin profile image
Martin Vandersteen

Git was made for this + collaboration. Basically each project you have should be a git repository. You can then push/pull changes from those repositories and everything will be synced. It doesn't replace the folder, it just applies changes fetched from git to the files that changed. Nothing else.

There is really no reason not to use git nowadays !

Collapse
 
mohitmehta1996 profile image
mohitmehta1996

Don't go with Git, because our local development has GBs of projects and uploding & download such large data is not feasible.
Instead keep your data in your laptop and share your htdocs (windows) / apache doc root (linux) to your local server (assuming your pc/laptop shares same network).
So, your shared folder (of laptop) can be accessed/modified in your PC, and projects can be run via local ip like 192.168.0.x

Collapse
 
sroehrl profile image
neoan

Sorry, but are you aware of the size of some monorepos out there? GIT works based on Delta changes, so you don't upload or download complete projects, just the changes. And obviously OP needs to run projects regardless of the current network, so I don't even know what you are referring to regarding serving the projects

Collapse
 
sroehrl profile image
neoan

GIT is the answer. Not only to the problem you currently have, but to the ones that will follow.

Collapse
 
okayfrederick profile image
fred321f

Okay, thank you. I will look into setting up a git system then. This should save me some money, since I won't have to go and invest $300+ dollars in a NAS-system.

Thank you all! :-)