dropbox-style svn/git/mercurial?:更改后自动提交并自动签出

发布于 2024-11-29 16:45:43 字数 242 浏览 0 评论 0原文

我不是专业的程序员,但我做了一些小型的独立项目,我想要一些版本控制和同步,但是经历记住提交和签出(在不同的计算机上)的过程比保留更麻烦保管箱文件夹中的代码会在文件更改时自动上传到云端。使用当前副本对我来说是完全透明的,但没有版本控制。 (同步也是一种痛苦,因为我回家后通常好几天都不会打开笔记本电脑。)

有没有一种方法可以让代码库在文件更改(或每隔几分钟)时自动提交,并在我需要时自动下载最新版本想在另一台计算机上继续我的工作吗?

谢谢!

I'm not a professional programmer, but I do some small solo projects and I would like some versioning and syncing, but going through the process of remember to commit and checkout (on different computers) is more of a hassle than, say, keeping code in a dropbox folder that automatically uploads to the cloud upon file change. Using the current copy is completely transparent to me, but there is no versioning. (Syncing is also a pain because I often don't open my laptop for days after getting home.)

Is there a way to have a codebase automatically commit upon file change (or just every few minutes) and automatically download the latest version if I want to continue my work from another computer?

Thanks!

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

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

发布评论

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

评论(3

皓月长歌 2024-12-06 16:45:44

Dropbox 在历史记录中保留了很少的文件版本。几乎不能称为“版本控制”,但您可以将文件恢复到过去的某个时间。

如果你真的不介意提交和合并,我会说直接使用 dropbox,因为它很好而且是自动的。

您可以设置计划任务(如果在 Windows 上)或 Cron 作业(如果在 Linux 上)每 5 分钟进行一次提交/推送。并在每次启动计算机时拉取/更新。
但我可以看到潜在的噩梦即将发生,特别是在拉取/更新时,当需要手动合并时。

另外,我建议使用 Mercurial,因为它比 git 更容易学习/处理,并且比 svn 更高级。这将消除版本控制系统的一些痛苦。

Dropbox keeps few versions of files in history. Hardly can be called "versioning", but you can restore files to some time back in the past.

If you really can not be bothered with commiting and merging, I'd say just live with dropbox, as it is nice and automatic.

You can set up Scheduled Task (if on Windows) or Cron Job (if Linux) that will make a commit/push every 5 minutes. And pull/update every time you start your computer.
But I can see a potential nightmare waiting to happen, especially on pull/update, when manual merge is required.

Also, I'd advise using Mercurial, as it is much easier to learn/deal with than git, and more advanced than svn. This will take away some pain from version-control system.

又爬满兰若 2024-12-06 16:45:44

所以我最终做的是使用云同步进行 Synology(但我过去使用的是 btsync )在多台计算机之间同步我的代码库。这创建了我一直在寻找的即时“自动同步”功能,并且它对我来说是完全透明的。 (这也解决了上面提到的臃肿的自动提交问题)通过这种方式,您可以获得版本控制和自动同步(或者被迫每天提交,或者担心在需要离开计算机时必须提交,或者必须处理在关闭笔记本电脑之前出现的任何提交错误,或者最重要的是必须依靠自己的错误记忆来记住每天提交(对我来说是一个大错误!))。不应该使用 git 进行同步(git 的意思是版本时间点,而不是同步)。注意:只需观察如何同步 .git 文件夹,这样就不会通过同步破坏一台计算机上的工作与另一台计算机上的工作。如果您将 .git 列入黑名单,您仍然可以克隆存储库并从任一计算机推送(但仍然不会通过将 .git 从一台计算机同步到另一台计算机来破坏事情)。

So what I ended up doing was using cloud sync for synology, (but I was using btsync in the past) to sync my code bases between several computers. This creates the immediate 'auto-sync' feature I was looking for and it's completely transparent to me. (This also takes care of the problems with having bloated auto-commits as mentioned above) This way you get versioning and auto-sync (or be forced to commit daily, or worry about having to commit when you need to leave your computer, or have to deal with any commit errors that come up before you close your laptop, or most of all have to rely one's fallible memory to remember to commit daily (big one for me!)). One SHOULD NOT be using git to sync (git is meant to version points in time, not sync). Note: just watch how you sync your .git folder so you dont break your work on one machine from the other via sync. If you blacklist .git, you can still clone the repo and push from either machine (but still not break things by syncing .git from one to the other).

捂风挽笑 2024-12-06 16:45:43

这取决于您的“项目”是什么。

Flashbake 是在科幻小说作家 Cory Doctorow 希望定期自动捕获和版本化他的写作过程后创建的:

每隔 15 分钟,Flashbake 就会查看您要求它检查的所有文件(我让它查看我所有正在创作的小说、我的待办事项列表、我的有用信息文件以及完整的电子版本)我最近的书),并记录自上次检查以来所做的任何更改,用系统时钟上的当前时区、从 Google 获取的该时区的天气以及最后三个标题(在它们下面带有您的署名)进行注释你的博客的RSS 提要(我一直将其描述为“我在哪里,那里是什么样子,我在想什么?”)。它还记录您计算机的正常运行时间。对于未来的版本,我认为让音乐播放器播放最新的三首歌曲会很有趣。 (来源

它基于git进行版本控制,并基于cron进行自动更新(git有足够的空间) -有效地使这变得容易处理)。
您可能需要查看另一篇评论。代码位于此处

如果您真的非常想要文件修改检测而不是每 X 分钟提交一次(又名对数据偏执),您可能需要 基于 inotify 的东西 (详细信息 - 请注意,这些自动提交可能会快速增加!)。

另一种选择(不一定能解决自动提交问题,因此您可能想要混合使用)是考虑在 dropbox 上运行 git。这已经已经在这里讨论过

It depends on what your "projects" are.

Flashbake was created after science-fiction writer Cory Doctorow wanted to automatically capture and version his writing process at regular intervals:

Every 15 minutes, Flashbake looks at any files that you ask it to check (I have it looking at all my fiction-in-progress, my todo list, my file of useful bits of information, and the completed electronic versions of my recent books), and records any changes made since the last check, annotating them with the current timezone on the system-clock, the weather in that timezone as fetched from Google, and the last three headlines with your by-line under them in your blog's RSS feed (I've been characterizing this as "Where am I, what's it like there, and what am I thinking about?"). It also records your computer's uptime. For a future version, I think it'd be fun to have the most recent three songs played by your music player. (source)

It is based on git for versioning, and cron for automatic updates (git is sufficiently space-efficient to make this tractable).
You may want to look at another review. The code is here.

If you really, really want file modification detection rather than a commit every X minutes (aka. paranoid about data), you may want something based on inotify (details - note those automated commits may add up quickly !).

Yet another option (that doesn't necessarily solve the auto-commit question, so you may want to mix) is to look at running git over dropbox. This has already been discussed here on SO.

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