Score:0

Synchronize VScode projects between linux and windows with WSL

vu flag

I'm new to WSL and got the advice to store my VScode projects on Linux for better performance.

The thing is, I would like to keep an automatic sync between these files stored on Linux and a folder stored on Windows since I would like these projects to be stored in my onedrive.

What would be the easiest option to do this?

EDIT: I made a symlink in Windows from the folder on Linux. Will synchronization with onedrive work correctly? (I'd like to be able to use those files again if I change computer). I heard I might get troubles with syncing those files (because of formating, versionning, ...), is it true in this case?

Score:0
vn flag

I'm new to WSL and got the advice to store my VScode projects on Linux for better performance.

Well, sort of. Assuming that your projects are Linux projects (using Linux-based tools in Ubuntu) and you are using the VSCode WSL Extension, then yes.

However, for projects that use Windows toolchains, it's better to keep those on the Windows drive.


I would like to keep an automatic sync between these files stored on Linux and a folder stored on Windows since I would like these projects to be stored in my OneDrive.

... I'd like to be able to use those files again if I change computer

There are multiple options to keep development projects backed up in the cloud. My first suggestion would be to use Git with a cloud repository such as Github (and many others). That way your projects aren't only backed up to the cloud, but you also get into the good development habit of committing your changes incrementally. You can also rollback to previous states, created branches when you want to try something without breaking your "working" copy, compare diffs, etc., etc., etc.

Another option, if you truly want to keep the files on both OneDrive and WSL/Ubuntu/Linux filesystems is to rsync between the two. However, do keep in mind that you'll probably need to slightly change your automount settings for WSL in order for this to work properly. See this question for details.

I made a symlink in Windows from the folder on Linux. Will synchronization with onedrive work correctly?

Probably not. Symlinks across filesystems are "soft", which means that they are just a "pointer" from one to the other, instead of keeping a copy of the files on both.

c.leblanc avatar
vu flag
Thank you. Getting used to Git sounds like a good idea! Following your advice, I just learned how to use the power shell commands to use Git/GitHub for code made through WSL and stored on the Linux drive. I still didn't figure out if there is a clever way to get notified every time I code something new (since there isn't a visual graphic interface allowing this automatically unlike what's stored on windows) or if there is a way to synchronize directly with GitHub everything I code on Ubuntu. Are those good ideas to explore? If it is, would you have any advices to achieve that?
c.leblanc avatar
vu flag
I actually found this: https://github.com/GitJournal/git-auto-sync ; would that be a good idea in my case?
NotTheDr01ds avatar
vn flag
@c.leblanc I would recommend getting used to manually committing, honestly. That way, when you commit, you add comments on what you changed. You also can establish a strategy where you commit *working* changes to the mainline, and you create branches for "in-progress" work that you then pull back into the mainline when complete. I'll be honest, I don't always do this properly myself in my projects (but I'm not a full-time developer, more of a Product Manager for, sometimes, developer tools).
c.leblanc avatar
vu flag
All right, I'll stick to that. Thanks for the advices
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.