windows 2GB USB 驱动器上的版本控制
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/97850/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Version control on a 2GB USB drive
提问by Jason Baker
For my school work, I do a lot of switching computers (from labs to my laptop to the library). I'd kind of like to put this code under some kind of version control. Of course the problem is that I can't always install additional software on the computers I use. Is there any kind of version control system that I can keep on a thumb drive? I have a 2GB drive to put this on, but I can get a bigger one if necessary.
对于我的学校作业,我经常更换电脑(从实验室到笔记本电脑再到图书馆)。我有点想将此代码置于某种版本控制之下。当然,问题是我不能总是在我使用的计算机上安装额外的软件。是否有任何类型的版本控制系统可以保存在拇指驱动器上?我有一个 2GB 的驱动器来安装它,但如果需要,我可以得到一个更大的驱动器。
The projects I'm doing aren't especially big FYI.
我正在做的项目并不是特别大的仅供参考。
EDIT:This needs to work under windows.
编辑:这需要在 Windows 下工作。
EDIT II:Bazaar ended up being what I chose. It's even better if you go with TortoiseBzr.
编辑二:Bazaar 最终成为我选择的。如果您使用 TortoiseBzr,那就更好了。
采纳答案by Martin W
You could use Portable Pythonand Bazaar(Bazaar is a Python app). I like to use Bazaar for my own personal projects because of its extreme simplicity. Plus, it can be portable because Python can be portable. You will just need to install it's dependencies in your Portable Python installation as well.
您可以使用Portable Python和Bazaar(Bazaar 是一个 Python 应用程序)。我喜欢将 Bazaar 用于我自己的个人项目,因为它极其简单。另外,它可以是可移植的,因为 Python 可以是可移植的。您只需要在便携式 Python 安装中安装它的依赖项。
回答by Milan Babu?kov
I do this with Git. Simply, create a Git repository of your directory:
我用 Git 来做这件事。简单地,为您的目录创建一个 Git 存储库:
git-init
git add .
git commit -m "Done"
Insert the stick, cd to directory on it (I have a big ext2 file I mount with -o loop), and do:
插入棒,cd 到它的目录(我有一个用 -o 循环挂载的大 ext2 文件),然后执行:
git-clone --bare /path/to/my/dir
Then, I take the stick to other computer (home, etc.). I can work directly on stick, or clone once again. Go to some dir on the hard disk and:
然后,我把棍子带到其他电脑(家里等)。我可以直接在棒上工作,也可以再次克隆。转到硬盘上的某个目录,然后:
git-clone /path/to/stick/repos
When I'm done with changes, I do 'git push' back to stick, and when I'm back at work, I 'git push' once again to move the changes from stick to work computer. Once you set this up, you can use 'git pull' to fetch the changes only (you don't need to clone anymore, just the first time) and 'git push' to push the changes the other way.
当我完成更改时,我执行 'git push' 返回到stick,当我回到工作中时,我再次'git push' 将更改从stick 移动到工作计算机。设置完成后,您可以使用 'git pull' 仅获取更改(您不再需要克隆,只是第一次)并使用 'git push' 以另一种方式推送更改。
The beauty of this is that you can see all the changes with 'git log' and even keep some unrelated work in sync when it changes at both places in the meantime.
这样做的好处在于,您可以使用“git log”查看所有更改,甚至可以在两个地方同时更改时保持一些不相关的工作同步。
If you don't like the command line, you can use graphical tools like gitk and git-gui.
如果您不喜欢命令行,可以使用 gitk 和 git-gui 等图形工具。
回答by Jonny Buchanan
Darcsis great for this purpose.
Darcs非常适合这个目的。
- I can't vouch for other platforms, but on Windows it's just a single executable file which you could keep on the drive.
- Most importantly, its interactive command line interface is fantastic and very quickly becomes intuitive (I now really miss interactive commits in any VCS which lacks them) - you don't need to memorise many commands as part of your normal workflow either. This is the main reason I use it over git for personal projects.
- 我不能保证其他平台,但在 Windows 上,它只是一个可以保留在驱动器上的可执行文件。
- 最重要的是,它的交互式命令行界面非常棒,并且很快变得直观(我现在真的很想念任何缺少它们的 VCS 中的交互式提交)——您也不需要记住许多命令作为正常工作流程的一部分。这是我在个人项目中使用它而不是 git 的主要原因。
Setting up:
配置:
darcs init
darcs add -r *
darcs record -am "Initial commit"
Creating a repository on your lab machine:
在您的实验室机器上创建存储库:
darcs get E:\path\to\repos
Checking what you've changed:
检查您更改的内容:
darcs whatsnew # Show all changed hunks of code
darcs whatsnew -ls # List all modified & new files
Interactively creating a new patch from your changes:
从您的更改交互式创建新补丁:
darcs record
Interactively pushing patches to the repository on the drive:
以交互方式将补丁推送到驱动器上的存储库:
darcs push
It's known to be slow for large projects, but I've never had any performance issues with the small to medium personal projects I've used it on.
众所周知,对于大型项目来说它很慢,但是我在使用它的中小型个人项目中从未遇到过任何性能问题。
Since there's no installation required you could even leave out the drive and just grab the darcs binary from the web - if I've forgotten my drive, I pull a copy of the repository I want to work on from the mirror I keep on my webspace, then create and email patches to myself as files:
由于不需要安装,您甚至可以省去驱动器,直接从网上获取 darcs 二进制文件 - 如果我忘记了驱动器,我会从镜像中提取我想要处理的存储库的副本,我保留在我的网站空间中,然后创建补丁并将其作为文件通过电子邮件发送给我自己:
darcs get http://example.com/repos/forum/
# Make changes and record patches
darcs send -o C:\changes.patch
回答by Justin Standard
The best answer for you is some sort of DVCS (popular ones being Git, Mercurial, Darcs, Bazaar...). The reason is that you have a full copy of the whole repository on any machine you are using. I haven't used these systems personally, so others will be best at recommending a DVCS with a small footprint and good cross platform compatibility.
对你来说最好的答案是某种 DVCS(流行的是Git、Mercurial、Darcs、Bazaar......)。原因是您在使用的任何机器上都有整个存储库的完整副本。我个人没有使用过这些系统,所以其他人最好推荐一个占用空间小且跨平台兼容性好的 DVCS。
回答by Aaron Jensen
回答by thing2k
Just to add an extra resource Subversion on a Stick. I've just set this up on my 4GB USB Drive, pretty simple and painless.
只是在 Stick 上添加一个额外的资源Subversion。我刚刚在我的 4GB USB 驱动器上设置了它,非常简单和轻松。
Thought I am now very tempted to try Bazaar.
以为我现在很想尝试 Bazaar。
Update: I've setup PortablePython on my USB drive, simple, but getting bazaar on there ...
I gave up, one dependency after another, and as I've got svn working.
If anyone knows of an easy portable installer, I'd be greatful.
更新:我已经在我的 USB 驱动器上设置了 PortablePython,很简单,但是在那里得到了集市......我放弃了,一个又一个的依赖,因为我已经让 svn 工作了。
如果有人知道一个简单的便携式安装程序,我会很高兴的。
回答by Stephen
I recommend Fossil http://www.fossil-scm.org/
我推荐 Fossil http://www.fossil-scm.org/
includes
包括
- command line
- dvcs
- cross platform (and easy to compile)
- 'autosync' command make the essential task of syncing to a backup easy.
- backup server configuration is a doddle.
- easy to learn/use
- very helpful community
- web ui with wiki and bugtracker included.
- 3.5Mb, single executable
- one sqlite database as the repository
- 命令行
- dvcs
- 跨平台(并且易于编译)
- 'autosync' 命令使同步到备份的基本任务变得容易。
- 备份服务器配置是轻而易举的。
- 易于学习/使用
- 非常有帮助的社区
- 包含 wiki 和 bugtracker 的 web ui。
- 3.5Mb,单个可执行文件
- 一个 sqlite 数据库作为存储库
回答by The Digital Gabeg
You could put the subversion binaries on there - they're only 16ish megs, so you'll have plenty of room for some repositories too. You can use the official binaries from the command line, or point a graphical tool (like TortoiseSVN) to the repository directory. If you're feeling fancy then you could rig the drive to autorun the SVNSERVE application, making any computer into a lightweight subversion server the minute you plug in the drive.
你可以把 subversion 二进制文件放在那里——它们只有 16 兆,所以你也有足够的空间来存放一些存储库。您可以从命令行使用官方二进制文件,或将图形工具(如TortoiseSVN)指向存储库目录。如果您喜欢,那么您可以装配驱动器以自动运行 SVNSERVE 应用程序,在您插入驱动器的那一刻,使任何计算机成为轻量级颠覆服务器。
I found some instructions for this process here.
我在这里找到了有关此过程的一些说明。
回答by epochwolf
I use subversion on my thumb drive, the official binaries will work right off the drive. The problem with this trick is you need to access a command line for this to work or be able to run batch files. Of course, I sync the files on my thumb drive to a server that I pay for. You could always host the repository on a desktop (use the file:/// protocol) if you don't want to get hosting space on the web.
我在我的拇指驱动器上使用 subversion,官方二进制文件将在驱动器上运行。这个技巧的问题是你需要访问命令行才能工作或能够运行批处理文件。当然,我会将拇指驱动器上的文件同步到我付费购买的服务器上。如果您不想在网络上获得托管空间,您可以始终将存储库托管在桌面上(使用 file:/// 协议)。
回答by Chris Jester-Young
I will get lynched for saying this answer, but it works under Windows: RCS.
我会因为说出这个答案而被私刑,但它在 Windows 下有效:RCS。
You simply make an RCS
directory in each of the directories with your code. When time comes to check things in, ci -u $FILE
. (Binary files also require you to run rcs -i -kb $FILE
before the first checkin.)
您只需RCS
使用代码在每个目录中创建一个目录。当需要检查东西时,ci -u $FILE
. (二进制文件还要求您rcs -i -kb $FILE
在第一次签入之前运行。)
Inside the RCS
directory are a bunch of ,v
files, which are compatible with CVS, should you wish to "upgrade" to that one day (and from there to any of the other VCS systems other posters mentioned). :-)
内部RCS
目录是一堆,v
文件,这些文件与CVS兼容,你应该想“升级”(并从那里到任何其他的VCS系统的其他海报中提到的)来那一天。:-)