简体   繁体   English

版本控制与您自己协调

[英]Version control to coordinate with yourself

For programming in my spare time, I have both a desktop and a laptop (both Macs, though I doubt that makes a difference the question). 对于我业余时间的编程,我有一台台式机和一台笔记本电脑(两台都是Mac机,但我怀疑这会对这个问题产生影响)。 I've got VMware on both of them, with Linux images to run my code on. 我已经在他们两个上安装了VMware,使用Linux映像来运行我的代码。 They're identical images, so I've got the same environment in both places. 它们是相同的图像,所以我在两个地方都有相同的环境。

The trick is that I like to use version control for ALL my coding, even when I'm not coordinating with someone else. 诀窍是我喜欢对我的所有编码使用版本控制,即使我没有与其他人协调。 I want to see the most recent version of my code on whichever system I'm using. 我希望在我使用的任何系统上看到我的代码的最新版本。

I don't want to depend on having network access at all times - I might be coding somewhere without wi-fi (yes, it's rare, but some places are still in the stone ages). 我不想一直依赖于网络访问 - 我可能在没有Wi-Fi的情况下进行编码(是的,它很少见,但有些地方仍处于石器时代)。 I'm looking at using git, but something like SVN would also do if I had the repository available locally. 我正在考虑使用git,但是如果我在本地提供了存储库,那么像SVN这样的东西也可以。 Or maybe the laptop becomes the SVN server and the desktop accesses it. 或者笔记本电脑可能成为SVN服务器,桌面也可以访问它。

Has anyone done this kind of thing before? 有没有人以前做过这种事情? Any traps/pitfalls/lessons learned? 任何陷阱/陷阱/经验教训?

I would highly recommend git if you won't have network access at all times. 如果您无法随时访问网络,我强烈推荐使用git。

However, if you still need to work with subversion repositories, you can still get the best of both worlds by using git-svn . 但是,如果您仍然需要使用subversion存储库,那么通过使用git-svn ,您仍然可以充分利用这两个世界。

Well, I'd definitely recommend looking at a distributed system instead of Subversion. 好吧,我绝对建议您查看分布式系统而不是Subversion。 That will satisfy your requirement of not being dependent on network access, and probably just fits your workflow better. 这将满足您不依赖于网络访问的要求,并且可能更适合您的工作流程。 The major choices for a distributed VCS are git , Mercurial (also referred to as "hg"), and Bazaar (or "bzr"). 分布式VCS的主要选择是gitMercurial (也称为“hg”)和Bazaar (或“bzr”)。 My personal preference is Mercurial, but they're all fairly comparable. 我个人的偏好是Mercurial,但它们都相当可比。

However, one thing that Mercurial does have over the others (and it's something that would be very helpful in your situation) is the "hg serve" command. 但是,Mercurial确实拥有的一件事(在你的情况下它会非常有用)是“hg serve”命令。 You can read about it here: Informal sharing with "hg serve" . 你可以在这里阅读: 非正式分享“hg serve” Basically it sets up a very simple (temporary) server to allow pulling your repository over the network. 基本上它设置了一个非常简单(临时)的服务器,允许通过网络提取存储库。 I use this all the time to keep code synchronized between my desktop and laptop. 我一直使用它来保持我的台式机和笔记本电脑之间的代码同步。 If I've made some changes on the laptop, I just run "hg serve" on there and then "hg pull" from the desktop, or vice versa if I've been working on the desktop. 如果我在笔记本电脑上进行了一些更改,我只需在那里运行“hg serve”,然后从桌面“hg pull”,或者反之亦然,如果我一直在桌面上工作。

So overall, I'd definitely suggest looking into the distributed systems, I think they'll do the best job of setting up the sort of environment you want. 总的来说,我肯定建议调查分布式系统,我认为他们会尽力设置你想要的环境。 There's a fair amount of information available on the web about using all of them. 网上有大量有关使用所有这些信息的信息。 I haven't spent much time with the others, but if you want to try Mercurial, this free online book covers pretty much everything you'll need to get started . 我没有花太多时间与其他人,但如果你想尝试Mercurial, 这本免费的在线书籍几乎涵盖了你开始所需的一切

Whatever you do, make sure your repository is backed up regularly. 无论您做什么,请确保定期备份您的存储库。 This is especially true if your laptop houses your repository. 如果您的笔记本电脑存放您的存储库,则尤其如此 You'll also want to think about what happens if your laptop gets stolen. 您还需要考虑如果您的笔记本电脑被盗会发生什么。 It might be better to use git and leave the repository on the desktop. 最好使用git并将存储库保留在桌面上。

As an alternative to Git, which has already been mentioned, I would highly recommend Bazaar . 作为已经提到的Git的替代品,我强烈推荐Bazaar It is a distributed VCS as git is, with some differences though. 它是一个分布式VCS,就像git一样,虽然存在一些差异。

For a (somewhat biased, of course) comparison, check out this page . 对于(当然有点偏颇)比较,请查看此页面

If you are after simplicity (setup), SVN is fine. 如果你是在简单(设置)之后,SVN很好。 It works without network connectivity because your entire history is kept on every sync'd PC, and SVN+SSH is TRIVIAL to set up. 它在没有网络连接的情况下工作,因为您的整个历史记录保存在每个同步的PC上,并且SVN + SSH是TRIVIAL设置的。 It uses the built-in ability of SSH to run a program, so if you have an SSH server set up, you just create a repository and everything works.. no server setup whatsoever. 它使用SSH的内置功能来运行程序,所以如果你设置了SSH服务器,你只需要创建一个存储库,一切正常......没有任何服务器设置。

This can also act as your backup since you have your entire repository on every computer you sync with. 这也可以作为您的备份,因为您在同步的每台计算机上都有整个存储库。

Distributed version control systems are interesting as well, but I think the upfront investment is higher but it has the advantage that you can save to your repository without being connected (not too critical if you are working alone, but being able to checkpoint and rollback anywhere can have it's advantages). 分布式版本控制系统也很有意思,但我认为前期投资更高,但它的优势在于您无需连接即可保存到存储库(如果您单独工作,则不是太关键,但能够在任何地方检查点和回滚可以有它的优点)。

SVN becomes pretty awkward to use when you don't have access to the repository. 当您无权访问存储库时,SVN变得非常难以使用。 Since I do all my development on one computer, I've gotten by fine with SVN, but you might not find it so easy. 由于我在一台计算机上完成了所有的开发工作,所以我对SVN做得很好,但是你可能觉得它不那么容易。 From what I've heard, that's exactly the kind of problem that git is designed to deal with - it lets you make commits that are registered in your local copy, then upload them all to the repository when you get access to it. 从我所听到的,这正是git旨在处理的问题 - 它允许您进行在本地副本中注册的提交,然后在您访问它时将它们全部上传到存储库。

You could consider getting an SVN host - they are fairly affordable and take the headache away from having to deal with your own network connectivity: 您可以考虑购买SVN主机 - 它们相当实惠,让您不必处理自己的网络连接:

http://www.google.com/search?hl=en&q=svn+hosting&btnG=Google+Search&aq=f&oq= http://www.google.com/search?hl=en&q=svn+hosting&btnG=Google+Search&aq=f&oq=

My favourite VCS is darcs since it supports patch cherry-picking. 我最喜欢的VCS是darcs,因为它支持补丁挑选。 It is a distributed VCS and it is VERY easy to use. 它是一个分布式VCS,非常容易使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM