在多个工作站之间同步代码的最佳方法?

发布于 2024-10-27 08:22:10 字数 372 浏览 1 评论 0原文

首先,我不确定这是否属于这里或程序员。如果需要的话请移动。

我主要是一个最有兴趣的网络开发人员,还有一些自由职业的副业。我可以在任何可能的地方进行编程,从便携式笔记本电脑到家用电脑。我已经很好地选择了 Net Beans 作为我的 IDE,并使用 xampp 作为我的测试环境。我的问题是如何最好地同步不同电脑之间的更改?

我开始将更改通过 FTP 传输到我的网络服务器上的“开发”区域,然后将它们传输到我的另一台 PC,但这有点痛苦。最近我开始使用 dropbox,它减轻了很多痛苦,但仍然没有我想要的那么完美。

有没有人想出一种万无一失的方法来轻松确保您始终在多台 PC 上打开文件的最新版本,而这些 PC 不一定总是(但有时)在您的家庭网络上?

免费是必需品。

Firstly, I'm not sure if this belongs here or programmers. Please move if it needs to be there.

I am mostly a hobbiest web developer, with a bit of freelance sidework. I program anywhere I can, from a laptop on the go to my home PC. I've pretty well settled on Net Beans as my IDE, and xampp for my test environment. My question is how do I best synchronize changes between my different PCs?

I started out FTPing changes to a "dev" area on my webserver, then FTPing them down to my other PC, but that's sort of a pain. Lately I have started using dropbox, which takes a lot of the pain out, but still isn't quite as seemless as I'd like.

Has anyone come up with a bulletproof way to easily ensure you're always opening up the latest version of your files across multiple PCs which aren't necessarily always (but sometimes are) on your home network?

Free is a necessity.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

蓝咒 2024-11-03 08:22:10

我个人使用 Subversion

它可以轻松地与 Netbeans 或 Eclipse 集成,并且您说您有一个 Web 服务器,我认为它是基于 Linux 的?它在任何 Linux 环境中都很容易设置,尽管我认为它也可以在 Windows 环境中设置。

然后,当您想要获取最新版本时,您只需对代码进行更新,在需要时进行签入,并且您可以随时返回到较早的代码(就像您尝试了两天的实验但没有成功)现在想删除所有内容并返回到正在运行的内容)。

I personally use Subversion.

It integrates easily with Netbeans or Eclipse, and you say you've got a webserver, which I presume is Linux based? It's easy to set up in any Linux environment, though I think it can also be set up in a Windows environment.

Then you just run an update on your code when you want to get the latest version, do checkins when you like it, and you can always go back to earlier code (like if you tried a two day experiment that didn't work out and now want to delete it all and go back to what you had that was working).

舟遥客 2024-11-03 08:22:10

使用一些版本控制系统。如果您是新手,Subversion 可能是最容易上手的,而且它与 Netbeans 集成得很好。

您可以在自己的服务器上设置存储库或使用一些外部服务 - 其中有很多,而且几乎每个人都提供一些免费计划作为开始。如果您愿意,我很乐意为您提供一些指导。

Use some version control system. If you are new to this stuff Subversion would be probably the easiest to start with and it is very well intergrated with Netbeans.

You may set up repository on your own server or use some external service - there are a lot of them and almost everyone offers some free plan to start with. I'd be glad to give you some pointers if you like.

独﹏钓一江月 2024-11-03 08:22:10

我不同意这里的很多答案(很多答案都很旧)。 Git/SVN 不是同步解决方案(也不是备份)。它只是一个版本控制系统。 (但如果操作正确,您可以同时使用 git 和同步工具。)

通过使用 git 进行同步,您会得到以下副作用:

  • 污染 git 日志:例如 git commit -am '同步文件'... '同步文件再次”、“从笔记本电脑同步”、“从桌面同步”
  • 不合标准的工作流程:每次离开工作站或笔记本电脑时,您都必须记住 git 提交和推送。这需要时间和精力

相反,我建议使用一种解决方案,将文件持续同步到中央服务器(或跨设备分散)。您可以在五秒(可能更短)内关闭笔记本电脑,您的更改将传播到中央服务器,等待其他设备上线时同步到它们。一项特权:您需要确保没有同步 .git 等文件夹,这样从笔记本电脑 .git 同步项目不会损坏桌面上的 .git。一些选项是:

  • Synology Cloudstation Drive - 我可以亲自谈谈这个。它排除所有“.”。默认情况下文件,并在每次文件更改时同步。一旦你保存文件,它就会同步
  • Syncthing - 我也可以谈论这个。移动客户端存在一些烦恼,但它运行良好,可以跨设备同步。
  • NextCloud/OwnCloud - 我现在使用 Nextcloud,同步所有计算机,并确保排除 .git,以便每个 git 存储库将跟踪针对源的独立更改,但仍然在设备之间同步。
  • 谷歌云端硬盘
  • Dropbox

I disagree with a lot of the answers here (A lot are pretty old). Git/SVN is not a synchronization solution (nor a backup). It is just a version control system. (But if done correctly you can use git and a sync tool at the same time.)

By using git for synchronization you get the following side effects:

  • polluted git log: e.g. git commit -am 'synced files'... 'synced files again', 'synced from laptop', 'synced from desktop'
  • a substandard workflow: every time you leave your workstation or laptop you have to remember to git commit and push. This takes time and mental energy

Instead, I would recommend a solution that offers a continuous sync of your files to a central server (or decentralized across devices). You can close your laptop within five seconds (maybe less) and your changes are propagated to a central server awaiting to sync to other devices when they come online. One priviso: you need to make sure you are not syncing folders like .git so a sync from your laptop .git for your project doesn't corrupt your .git on your desktop. Some options are:

  • Synology Cloudstation Drive - I can speak personally to this one. It excludes all "." files by default, and syncs at every file change. As soon as you save the file it is synced
  • Syncthing - I also can speak to this one. There's some annoyances with the mobile client, but it works well enough to sync across devices.
  • NextCloud/OwnCloud - I now use Nextcloud, sync all computers, and make sure to exclude .git so that each git repo will track independent changes against origin BUT still be synced between devices.
  • Google Drive
  • Dropbox
别念他 2024-11-03 08:22:10

学习使用版本控制系统。

www.github.com 对于开源项目是免费的,但必须为私有源存储库付费以及闭源项目,万岁。

http://unfuddle.com 使用 subversion,并且免费提供 200Mb 的私人源代码。

您可能会发现此线程中的一些链接很有用。

Learn to use a version control system.

www.github.com is free for open source projects, but must pay for private source repositories and also closed source projects, hurray.

http://unfuddle.com uses subversion, and is free for 200Mb of private source.

You may find some of the links in this thread useful.

剑心龙吟 2024-11-03 08:22:10

一个非常简单有效的方法是在 dropbox.com 上开设帐户。

A very simple and efficient way is to open an account on dropbox.com.

﹎☆浅夏丿初晴 2024-11-03 08:22:10

您可以在 http://www.github.com 等网站上设置一个基于 Web 的源代码存储库,然后能够从任何计算机访问它。

You can set up a web-based source repository on something like http://www.github.com, and be able to access it from any computer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文