Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Svn 从git到subversion(是的,就是这样):使用主干_Svn_Version Control_Git Svn - Fatal编程技术网

Svn 从git到subversion(是的,就是这样):使用主干

Svn 从git到subversion(是的,就是这样):使用主干,svn,version-control,git-svn,Svn,Version Control,Git Svn,我已经使用git两年了,我非常喜欢它。然而,我正在为一家坚持使用svn的公司做一些工作,所以我需要将我的git方式移植到svn 这是我到目前为止学到的: 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" 它检查我的回购协议,添加一个文件,提交它,然后推送它 我已经有了一个非svn项

我已经使用git两年了,我非常喜欢它。然而,我正在为一家坚持使用svn的公司做一些工作,所以我需要将我的git方式移植到svn

这是我到目前为止学到的:

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"
它检查我的回购协议,添加一个文件,提交它,然后推送它

我已经有了一个非svn项目(也是非git的,它还不在版本控制之下(我知道这很糟糕))。如何将现有项目转化为svn回购?我可以这样做:

svn co https://the.remote.repo my_existing_non_svn_directory
它在
my\u existing\u non\u svn\u目录中创建一个
trunk
子目录。使用
git
时,没有
trunk
,因此这可以工作,但是使用
svn
,我是否必须将所有代码移动到trunk中?有没有办法解决这个问题,或者这只是一个
svn
问题

非常感谢。

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

svn co https://the.remote.repo/trunk myrepo
这样,您的工作目录中就不会有trunk/tags/branchs层次结构,这使得这个过程更简单、更快

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

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

svn co https://the.remote.repo/trunk myrepo
这样,您的工作目录中就不会有trunk/tags/branchs层次结构,这使得这个过程更简单、更快


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

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

>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
并在稍后通过该回购协议处理git svn

另一种风格

  • svn co
    清空新中继
  • 将项目树复制到WC中
  • 添加/忽略/提交

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

>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
并在稍后通过该回购协议处理git svn

另一种风格

  • svn co
    清空新中继
  • 将项目树复制到WC中
  • 添加/忽略/提交

没有必要停止使用git。改用git svn
。您可以保留一个本地git存储库,
git svn
会将您的更改推送到svn中。无需停止使用git。改用git svn。您可以保留一个本地git存储库,
git svn
将把您的更改推送到svn中。