在家庭和办公室进行开发,使用xcopy可以使GIT比SVN容易吗? [英] developing at home and office, would GIT be easier than SVN using xcopy?

查看:58
本文介绍了在家庭和办公室进行开发,使用xcopy可以使GIT比SVN容易吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果出于安全原因,源代码只能存储在我的家用计算机和办公计算机上,如果唯一的代码传输方法是USB密钥,那么哪种源代码控制才是最好的?

If, for security reasons, source code can only be stored on my home computer and office computer, which source control would be best IF the only method of transporting the code would be a USB key?

SVN还是GIT?

注意:两台计算机之间没有网络连接.

note: there is no network connection between the 2 computers.

推荐答案

我推荐git.

无论哪种方式,您都需要USB闪存盘上的规范存储库.在git中,您可以这样做:

Either way you're going to want the canonical repository on the USB key. In git you might do this:

在USB闪存盘上进行裸露"存储库:

Make a "bare" repo on the USB key:

$ mkdir /path/to/usbkey/myapp.git
$ cd /path/to/usbkey/myapp.git/
$ git init --bare
Initialized empty Git repository in /path/to/usbkey/myapp.git/

裸仓库目录通常被命名为"something.git"-您可以随意命名,但是".git"约定被广泛使用.

Bare repository directories are usually named "something.git" - you can name them whatever you want, but the ".git" convention is very widely used.

现在您可以克隆存储库了:

Now you can clone the repo:

$ cd /my/source/dir/
$ git clone /path/to/usbkey/myapp.git
Initialized empty Git repository in /my/source/dir/myapp/.git/
warning: You appear to have cloned an empty repository.

它将警告您存储库为空.让我们放一些东西:

It will warn you that the repo is empty. Let's put something in it:

$ cd myapp
$ echo "some stuff." > README
$ git add README
$ git commit -m 'added a README'
[master (root-commit) 155b8ea] added a README
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 README

然后将其推入USB闪存盘:

And then push it to the USB key:

$ git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 231 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
To /path/to/usbkey/myapp.git
 * [new branch]      master -> master

当您到达另一台计算机时,只需再次从USB密钥克隆存储库即可.您必须确保记得要进行更改,但是您知道将始终有一个备份,因为每次同步后,您将拥有三个完整的回购副本.

When you get to your other computer, just clone the repo from your USB key again. You'll have to make sure you remember to push your changes, but you know you'll always have a backup because you'll have three full copies of the repo whenever you're synced up.

使用git的另一种方法是只拥有一个存储库-USB密钥上的一个存储库.您将永远不必记住要推送它,但是除非您使用其他显式备份系统,否则您的代码将只有关键.那就不好了.

An alternate way to do it with git is to only have one repo - the one on the USB key. You wouldn't ever have to remember to push to it, but your code would only be on the key unless you used some other explicit backup system. That would be bad.

如果要在USB密钥上使用SVN,则仍然需要记住以裸仓库回购的相同方式来提交和拉出更改,但是您将无法获得免费的自动备份. git给你.另外,您可能会错过git的所有其他优点,但这是另一个完整的讨论.请参见为什么Git比X更好.

If you were to use SVN on the USB key you would still have to remember to commit and pull your changes in the same way has having a bare git repo, but you wouldn't get the free automatic backups that doing so with git gives you. Also you would miss out on all the other niceties of git, but that's a whole other discussion. See Why Git is Better Than X.

这篇关于在家庭和办公室进行开发,使用xcopy可以使GIT比SVN容易吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆