1

I have been using git for 2 years now and love it. However, I am doing some work for a company that insist in using svn so I need to port my git way of doing things to svn.

This is what I have learned so far:

svn co https://the.remote.repo
touch myrepo/trunk/mytest.c
svn add myrepo/trunk/mytest.c 
cd myrepo/
svn commit -m "added test file"

which checks out my repo, adds a file, commit it and then pushes it.

I already have a non-svn project (non-git too, it's not under version control yet (awful I know)). How can I turn my existing project into a svn repo ? I can do this:

svn co https://the.remote.repo my_existing_non_svn_directory

which creates a trunk sub-directory in my_existing_non_svn_directory. With git there is no trunk so this would work but with svn, do I have to move all my code into the trunk ? Is there some way round this or is it just an svn thing ?

Many thanks.

4

2 回答 2

3

使用 Subversion(与 Git 不同),您可以轻松检出部分树。因此,在您的第一个示例中,您可能会这样做:

svn co https://the.remote.repo/trunk myrepo

这样您的工作目录中就不会出现trunk/tags/branches 层次结构,这使得这更简单、更快捷。

在您的第二个示例中,如果您有一个大部分为空的 Subversion 存储库(您已在其中设置了 trunk/tags/branches 层次结构),那么您可以签出https://the.remote/repo/trunk并获取一个可以添加文件的空目录。

于 2012-10-15T21:04:39.687 回答
1

您可以将未版本化的树导入存储库:

>svn help import
import: Commit an unversioned file or tree into the repository.

svn import my_existing_non_svn_directory https://the.remote.repo/trunk

稍后使用这个 repo 处理 git-svn

另一种风格

  • svn co空新后备箱
  • 将项目树复制到 WC
  • 添加/忽略/提交
于 2012-10-15T22:35:15.237 回答